home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / documents / Dwarf / libdwarf2.1.mm < prev    next >
Text File  |  1996-11-11  |  131KB  |  3,621 lines

  1. \."
  2. \." the following line may be removed if the ff ligature works on your machine
  3. .lg 0
  4. \." set up heading formats
  5. .ds HF 3 3 3 3 3 2 2
  6. .ds HP +2 +2 +1 +0 +0
  7. .nr Hs 5
  8. .nr Hb 5
  9. .ds | |
  10. .ds ~ ~
  11. .ds ' '
  12. .if t .ds Cw \&\f(CW
  13. .if n .ds Cw \fB
  14. .de Cf          \" Place every other arg in Cw font, beginning with first
  15. .if \\n(.$=1 \&\*(Cw\\$1\fP
  16. .if \\n(.$=2 \&\*(Cw\\$1\fP\\$2
  17. .if \\n(.$=3 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP
  18. .if \\n(.$=4 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4
  19. .if \\n(.$=5 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP
  20. .if \\n(.$=6 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6
  21. .if \\n(.$=7 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP
  22. .if \\n(.$=8 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP\\$8
  23. .if \\n(.$=9 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP\\$8\
  24. *(Cw
  25. ..
  26. .SA 1
  27. .TL
  28. A Consumer Library Interface to DWARF 
  29. .AF ""
  30. .AU "UNIX\(rg International Programming Languages Special Interest Group" 
  31. .PF "'$Revision: 1.1 $'- \\\\nP -'$Date: 1996/03/17 23:17:20 $'"
  32. .PM ""
  33. .AS 1
  34. This document describes an interface to a library of functions
  35. .FS \(rg
  36. UNIX is a registered trademark of UNIX System Laboratories, Inc.
  37. in the United States and other countries.
  38. .FE
  39. to access DWARF debugging information entries and DWARF line number
  40. information. It does not make recommendations as to how the functions
  41. described in this document should be implemented nor does it
  42. suggest possible optimizations. 
  43. .P
  44. The document is oriented to reading DWARF version 2.
  45. There are certain sections which are SGI-specific (those
  46. are clearly identified in the document).
  47. We intend to propose this 
  48. to the PLSIG committee
  49. as the basis for a
  50. standard libdwarf interface.
  51. .P
  52. The proposals made in this document are subject to change.
  53. .P
  54. $Revision: 1.1 $
  55. .P
  56. $Date: 1996/03/17 23:17:20 $
  57.  
  58. .AE
  59. .MT 4
  60.  
  61. .H 1 "INTRODUCTION"
  62. This document describes the proposed interface to \fIlibdwarf\fP, a
  63. library of functions to provide access to DWARF debugging information
  64. records, DWARF line number information, DWARF address range and global 
  65. names information, weak names information, DWARF frame description 
  66. information, DWARF static function names, DWARF static variables, and 
  67. DWARF type information.
  68. .P
  69.  
  70. .H 2 "Purpose and Scope"
  71. The purpose of this document is to propose a library of functions 
  72. to access DWARF debugging information. There is no effort made in 
  73. this document to address the creation of these records as those
  74. issues will be addressed seperately.
  75.  
  76. .P
  77. Additionally, the focus of this document is the functional interface,
  78. and as such, implementation as well as optimization issues are
  79. intentionally ignored.
  80.  
  81. .H 2 "Definitions"
  82. DWARF debugging information entries (DIE) are the segments of information 
  83. placed in the \f(CW.debug_*\fP sections by compilers, assemblers, and 
  84. linkage editors that, in conjunction with line number entries, are 
  85. necessary for symbolic source-level debugging.  Refer to the document 
  86. "\fIDWARF Debugging Information Format\fP" from UI PLSIG for a more 
  87. complete description of these entries.
  88.  
  89. .P
  90. This document adopts all the terms and definitions in "\fIDWARF Debugging 
  91. Information Format\fP" version 2.  It focuses on the implementation at
  92. Silicon Graphics Computer Systems.  Although we believe the interface
  93. is general enough to be of interest to other vendors too, there are a
  94. few places where changes may need to be made.
  95.  
  96. .H 2 "Overview"
  97. The remaining sections of this document describe the proposed interface
  98. to \f(CWlibdwarf\fP, first by describing the purpose of additional types
  99. defined by the interface, followed by descriptions of the available 
  100. operations.  This document assumes you are thoroughly familiar with the 
  101. information contained in the \fIDWARF Debugging Information Format\fP 
  102. document. 
  103. .P
  104. We separate the functions into several categories to emphasize that not 
  105. all consumers want to use all the functions.  We call the categories 
  106. Debugger, Internal-level, High-level, and Miscellaneous not because one is more 
  107. important than another but as a way of making the rather large set of 
  108. function calls easier to understand.
  109. .P
  110. Unless otherwise specified, all functions and structures should be
  111. taken as being designed for Debugger consumers.
  112. .P
  113. The Debugger Interface of this library is intended to be used by debuggers. 
  114. The interface is low-level (close to dwarf) but suppresses irrelevant detail.
  115. A debugger will want to absorb all of some sections at startup and will 
  116. want to see little or nothing of some sections except at need.  And even 
  117. then will probably want to absorb only the information in a single compilation 
  118. unit at a time.  A debugger does not care about
  119. implementation details of the library.
  120. .P
  121. The Internal-level Interface is for a DWARF prettyprinter and checker.  
  122. thorough prettyprinter will want to know all kinds of internal things 
  123. (like actual FORM numbers and actual offsets) so it can check for 
  124. appropriate structure in the DWARF data and print (on request) all 
  125. that internal information for human users and libdwarf authors and 
  126. compiler-writers.  
  127. Calls in this interface provide data a debugger 
  128. does not care about.
  129. .P
  130. The High-level Interface is for higher level access
  131. (it's not really a high level interface!).  
  132. Programs such as 
  133. disassemblers will want to be able to display relevant information 
  134. about functions and line numbers without having to invest too much 
  135. effort in looking at DWARF.
  136. .P
  137. The miscellaneous interface is just what is left over: the error handler 
  138. functions.
  139. .P
  140. The following is a brief mention of the changes in this libdwarf from 
  141. the libdwarf draft for DWARF Version 1.
  142. .H 2 "Items Changed"
  143. dwarf_nextglob(), dwarf_globname(), and dwarf_globdie() were all changed 
  144. to operate on the items in the .debug_pubnames section.
  145. .P
  146. All functions were modified to return solely an error code.
  147. Data is returned through pointer arguments.
  148. This makes writing safe and correct library-using-code far easier.
  149. For justification for this approach, see the book by
  150. Steve Maguire titled "Writing Solid Code" at your bookstore.
  151.  
  152.  
  153. .H 2 "Items Removed"
  154. .P
  155. Dwarf_Type
  156. was removed since types are no longer special.
  157. .P
  158. dwarf_typeof()
  159. was removed since types are no longer special.
  160. .P
  161. Dwarf_Ellist
  162. was removed since element lists no longer are a special format.
  163. .P
  164. Dwarf_Bounds
  165. was removed since bounds have been generalized.
  166. .P
  167. dwarf_nextdie()
  168. was replaced by dwarf_next_cu_header() to reflect the
  169. real way dwarf is organized.
  170. The dwarf_nextdie() was only useful for getting to compilation
  171. unit beginnings, so it does not seem harmful to remove it in favor
  172. of a more direct function.
  173. .P
  174. dwarf_childcnt() is removed on grounds
  175. that no good use was apparent.
  176. .P
  177. dwarf_prevline() and dwarf_nextline() were removed on grounds this
  178. is better left to a debugger to do.
  179. Similarly, dwarf_dieline() was removed.
  180. .P
  181. dwarf_is1stline() was removed as it was not meaningful for the
  182. revised dwarf line operations.
  183. .P
  184. Any libdwarf implementation might well decide to support all the
  185. removed functionality and to retain the DWARF Version 1 meanings
  186. of that functionality.  
  187. This would be difficult because the
  188. original libdwarf draft
  189. specification used traditional C library interfaces which
  190. confuse the values returned by successful calls with
  191. exceptional conditions like failures and 'no more data' indications.
  192.  
  193. .H 2 "Revision History"
  194. .VL 15
  195. .LI "March 93"
  196. Work on dwarf2 SGI draft begins
  197. .LI "June 94"
  198. The function returns are changed to return an error/success code
  199. only.
  200. .LE
  201.  
  202. .H 1 "Types Definitions"
  203.  
  204. .H 2 "General Description"
  205. The \fIlibdwarf.h\fP header file contains typedefs and preprocessor 
  206. definitions of types and symbolic names used to reference objects 
  207. of \fIlibdwarf\fP. The types defined by typedefs contained in 
  208. \fIlibdwarf.h\fP all use the convention of adding \f(CWDwarf_\fP 
  209. as a prefix and can be placed in three categories: 
  210.  
  211. .BL
  212. .LI
  213. Scalar types : The scalar types defined in \fIlibdwarf.h\fP are
  214. defined primarily for notational convenience and identification.
  215. Depending on the individual definition, they are interpreted as a 
  216. value, a pointer, or as a flag.
  217. .LI
  218. Aggregate types : Some values can not be represented by a single 
  219. scalar type; they must be represented by a collection of, or as a 
  220. union of, scalar and/or aggregate types. 
  221. .LI
  222. Opaque types : The complete definition of these types is intentionally
  223. omitted; their use is as handles for query operations, which will yield
  224. either an instance of another opaque type to be used in another query, or 
  225. an instance of a scalar or aggregate type, which is the actual result.
  226. .P
  227.  
  228. .H 2 "Scalar Types"
  229. The following are the defined by \fIlibdwarf.h\fP:
  230.  
  231. .DS
  232. \f(CW
  233. typedef int                Dwarf_Bool;
  234. typedef unsigned long long Dwarf_Off;
  235. typedef unsigned long long Dwarf_Unsigned;
  236. typedef unsigned short     Dwarf_Half;
  237. typedef unsigned char      Dwarf_Small;
  238. typedef signed long long   Dwarf_Signed;
  239. typedef unsigned long long Dwarf_Addr;
  240. typedef void            *Dwarf_Ptr;
  241. typedef void   (*Dwarf_Handler)(Dwarf_Error *error, Dwarf_Ptr errarg);
  242. .DE
  243.  
  244. .nr aX \n(Fg+1
  245. Dwarf_Ptr is an address for use by the host program calling the library,
  246. not for representing pc-values/addresses within the target object file.
  247. Dwarf_Addr is for pc-values within the target object file.  The sample 
  248. scalar type assignments above are for a \fIlibdwarf.h\fP that can read 
  249. and write
  250. 32-bit or 64-bit binaries on a 32-bit or 64-bit host machine.
  251. The types must be  defined appropriately
  252. for each implementation of libdwarf.
  253. A description of these scalar types in the SGI/MIPS
  254. environment is given in Figure \n(aX.
  255.  
  256. .DS
  257. .TS
  258. center box, tab(:);
  259. lfB lfB lfB lfB
  260. l c c l.
  261. NAME:SIZE:ALIGNMENT:PURPOSE
  262. _
  263. Dwarf_Bool:4:4:Boolean states
  264. Dwarf_Off:8:8:Unsigned file offset
  265. Dwarf_Unsigned:8:8:Unsigned large integer
  266. Dwarf_Half:2:2:Unsigned medium integer
  267. Dwarf_Small:1:1:Unsigned small integer
  268. Dwarf_Signed:8:8:Signed large integer
  269. Dwarf_Addr:8:8:Program address (target program)
  270. Dwarf_Ptr:4|8:4|8:Dwarf section pointer (host program)
  271. Dwarf_Handler:4|8:4|8:Pointer to libdwarf error handler 
  272. :::error handler function 
  273. .TE
  274. .FG "Scalar Types"
  275. .DE
  276.  
  277. .H 2 "Aggregate Types"
  278. The following aggregate types are defined by 
  279. the SGI 
  280. \fIlibdwarf.h\fP:
  281. \f(CWDwarf_Loc\fP,
  282. \f(CWDwarf_Locdesc\fP,
  283. \f(CWDwarf_Block\fP, 
  284. \f(CWDwarf_Frame_Op\fP. 
  285. While most of \f(CWlibdwarf\fP acts on or returns simple values or
  286. opaque pointer types, this small set of structures seems useful.
  287.  
  288. .H 3 "Location Record"
  289. The \f(CWDwarf_Loc\fP type identifies a single atom of a location description
  290. or a location expression.
  291.  
  292. .DS
  293. \f(CWtypedef struct {
  294.         Dwarf_Small        lr_atom;
  295.         Dwarf_Unsigned     lr_number;
  296.         Dwarf_Unsigned     lr_number2;
  297.         Dwarf_Unsigned     lr_offset;  
  298. } Dwarf_Loc;\fP
  299. .DE
  300.  
  301. The \f(CWlr_atom\fP identifies the atom corresponding to the \f(CWDW_OP_*\fP 
  302. definition in \fIdwarf.h\fP and it represents the operation to be performed 
  303. in order to locate the item in question.
  304.  
  305. .P
  306. The \f(CWlr_number\fP field is the operand to be used in the calculation
  307. specified by the \f(CWlr_atom\fP field; not all atoms use this field.
  308. Some atom operations imply signed numbers so it is necessary to cast 
  309. this to a \f(CWDwarf_Signed\fP type for those operations.
  310.  
  311. .P
  312. The \f(CWlr_number2\fP field is the second operand specified by the 
  313. \f(CWlr_atom\fP field; only \f(CWDW_OP_BREGX\fP has this field.  Some 
  314. atom operations imply signed numbers so it may be necessary to cast 
  315. this to a \f(CWDwarf_Signed\fP type for those operations.
  316.  
  317. .P
  318. The \f(CWlr_offset\fP field is the byte offset (within the block the 
  319. location record came from) of the atom specified by the \f(CWlr_atom\fP 
  320. field.  This is set on all atoms.  This is useful for operations 
  321. \f(CWDW_OP_SKIP\fP and \f(CWDW_OP_BRA\fP.
  322.  
  323. .H 3 "Location Description"
  324. The \f(CWDwarf_Locdesc\fP type represents an ordered list of 
  325. \f(CWDwarf_Loc\fP records used in the calculation to locate 
  326. an item.  Note that in many cases, the location can only be 
  327. calculated at runtime of the associated program.
  328.  
  329. .DS
  330. \f(CWtypedef struct {
  331.         Dwarf_Addr        ld_lopc;
  332.         Dwarf_Addr        ld_hipc;
  333.         Dwarf_Unsigned    ld_cents;
  334.         Dwarf_Loc*        ld_s;
  335. } Dwarf_Locdesc;\fP
  336. .DE
  337.  
  338. The \f(CWld_lopc\fP and \f(CWld_hipc\fP fields provide an address range for
  339. which this location descriptor is valid.  Both of these fields are set to
  340. \fIzero\fP if the location descriptor is valid throughout the scope of the
  341. item it is associated with.  These addresses are virtual memory addresses, 
  342. not offsets-from-something.  The virtual memory addresses do not account 
  343. for dso movement (none of the pc values from libdwarf do that, it is up to 
  344. the consumer to do that).
  345.  
  346. .P
  347. The \f(CWld_cents\fP field contains a count of the number of \f(CWDwarf_Loc\fP 
  348. entries pointed to by the \f(CWld_s\fP field.
  349.  
  350. .P
  351. The \f(CWld_s\fP field points to an array of \f(CWDwarf_Loc\fP records. 
  352.  
  353. .H 3 "Data Block"
  354. .SP
  355. The \f(CWDwarf_Block\fP type is used to contain the value of an attribute
  356. whose form is either \f(CWDW_FORM_block1\fP, \f(CWDW_FORM_block2\fP, 
  357. \f(CWDW_FORM_block4\fP, \f(CWDW_FORM_block8\fP, or \f(CWDW_FORM_block\fP.
  358. Its intended use is to deliver the value for an attribute of any of these 
  359. forms.
  360.  
  361. .DS
  362. \f(CWtypedef struct {
  363.         Dwarf_Unsigned     bl_len;
  364.         Dwarf_Ptr          bl_data;
  365. } Dwarf_Block;\fP
  366. .DE
  367.  
  368. .P
  369. The \f(CWbl_len\fP field contains the length in bytes of the data pointed
  370. to by the \f(CWbl_data\fP field. 
  371.  
  372. .P
  373. The \f(CWbl_data\fP field contains a pointer to the uninterpreted data.
  374. Since we use  a \f(CWDwarf_Ptr\fP here one must copy the pointer to some 
  375. other type (typically an \f(CWunsigned char *\fP) so one can add increments 
  376. to index through the data.  The data pointed to by \f(CWbl_data\fP is not 
  377. necessarily at any useful alignment.
  378.  
  379. .H 3 "Frame Operation Codes"
  380. The \f(CWDwarf_Frame_Op\fP type is used to contain the data of a single
  381. instruction of an instruction-sequence of low-level information from the 
  382. section containing frame information.  This is ordinarily used by 
  383. Internal-level 
  384. Consumers trying to print everything in detail.
  385.  
  386. .DS
  387. \f(CWtypedef struct {
  388.     Dwarf_Small  fp_base_op;
  389.     Dwarf_Small  fp_extended_op;
  390.     Dwarf_Half   fp_register;
  391.     Dwarf_Signed fp_offset;
  392.     Dwarf_Offset fp_instr_offset;
  393. } Dwarf_Frame_Op;
  394. .DE
  395.  
  396. \f(CWfp_base_op\fP is the 2-bit basic op code.  \f(CWfp_extended_op\fP is 
  397. the 6-bit extended opcode (if \f(CWfp_base_op\fP indicated there was an 
  398. extended op code) and is zero otherwise.
  399. .P
  400. \f(CWfp_register\fP 
  401. is any (or the first) register value as defined
  402. in the \f(CWCall Frame Instruction Encodings\fP figure
  403. in the \f(CWdwarf\fP document.
  404. If not used with the Op it is 0.
  405. .P
  406. \f(CWfp_offset\fP
  407. is the address, delta, offset, or second register as defined
  408. in the \f(CWCall Frame Instruction Encodings\fP figure
  409. in the \f(CWdwarf\fP document.
  410. If this is an \f(CWaddress\fP then the value should be cast to
  411. \f(CW(Dwarf_Addr)\fP before being used.
  412. In any implemenation this field *must* be as large as the
  413. larger of Dwarf_Signed and Dwarf_Addr for this to work properly.
  414. If not used with the op it is 0.
  415. .P
  416. \f(CWfp_instr_offset\fP is the byte_offset (within the instruction
  417. stream of the frame instructions) of this operation.  It starts at 0
  418. for a given frame descriptor.
  419. .H 3 "Macro Details Record"
  420. The \f(CWDwarf_Macro_Details\fP type gives information about
  421. a single entry in the .debug.macinfo section.
  422. .DS
  423. \f(CWstruct Dwarf_Macro_Details_s {
  424.   Dwarf_Off    dmd_offset;
  425.   Dwarf_Small  dmd_type;  
  426.   Dwarf_Signed dmd_lineno;
  427.   Dwarf_Signed dmd_fileindex;
  428.   char *       dmd_macro;
  429. };
  430. typedef struct Dwarf_Macro_Details_s Dwarf_Macro_Details;
  431. .DE
  432. .P
  433. \f(CWdmd_offset\fP is the byte offset, within the .debug_macinfo
  434. section, of this macro information.
  435. .P
  436. \f(CWdmd_type\fP is the type code of this macro info entry
  437. (or 0, the type code indicating that this is the end of
  438. macro information entries for a compilation unit.
  439. See \f(CWDW_MACINFO_define\fP, etc in the DWARF document.
  440. .P
  441. \f(CWdmd_lineno\fP is the line number where this entry was found,
  442. or 0 if there is no applicable line number.
  443. .P
  444. \f(CWdmd_fileindex\fP is the file index of the file involved.
  445. This is only guaranteed meaningful on a \f(CWDW_MACINFO_start_file\fP
  446. \f(CWdmd_type\fP.  Set to -1 if unknown (see the functional
  447. interface for more details).
  448. .P
  449. \f(CWdmd_macro\fP is the applicable string.
  450. For a \f(CWDW_MACINFO_define\fP
  451. this is the macro name and value.
  452. For a
  453. \f(CWDW_MACINFO_undef\fP, or
  454. this is the macro name.
  455. For a
  456. \f(CWDW_MACINFO_vendor_ext\fP
  457. this is the vendor-defined string value.
  458. For other \f(CWdmd_type\fPs this is 0.
  459.  
  460. .H 2 "Opaque Types"
  461. The opaque types declared in \fIlibdwarf.h\fP are used as descriptors
  462. for queries against dwarf information stored in various debugging 
  463. sections.  Each time an instance of an opaque type is returned as a 
  464. result of a \fIlibdwarf\fP operation (\f(CWDwarf_Debug\fP excepted), 
  465. it should be free'd, using \f(CWdwarf_dealloc()\fP when it is no longer 
  466. of use.  
  467. Some functions return a number of instances of an opaque type 
  468. in a block, by means of a pointer to the block and a count of the number
  469. of opaque descriptors in the block:
  470. see the function description for deallocation rules for such functions.
  471. The list of opaque types defined 
  472. in \fIlibdwarf.h\fP that are pertinent to the Consumer Library, and their 
  473. intended use is described below.
  474.  
  475. .DS
  476. \f(CWtypedef struct Dwarf_Debug_s* Dwarf_Debug;\fP
  477. .DE
  478. An instance of the \f(CWDwarf_Debug\fP type is created as a result of a 
  479. successful call to \f(CWdwarf_init()\fP, or \f(CWdwarf_elf_init()\fP, 
  480. and is used as a descriptor for subsequent access to most \f(CWlibdwarf\fP
  481. functions on that object.  The storage pointed to by this descriptor 
  482. should be not be free'd, using the \f(CWdwarf_dealloc()\fP function.
  483. Instead free it with \f(CWdwarf_finish()\fP.
  484. .P
  485.  
  486. .DS
  487. \f(CWtypedef struct Dwarf_Die_s* Dwarf_Die;\fP
  488. .DE
  489. An instance of a \f(CWDwarf_Die\fP type is returned from a successful 
  490. call to the \f(CWdwarf_siblingof()\fP, \f(CWdwarf_child\fP, or 
  491. \f(CWdwarf_offdie()\fP function, and is used as a descriptor for queries 
  492. about information related to that DIE.  The storage pointed to by this 
  493. descriptor should be free'd, using \f(CWdwarf_dealloc()\fP with the allocation 
  494. type \f(CWDW_DLA_DIE\fP when no longer needed.
  495.  
  496. .DS
  497. \f(CWtypedef struct Dwarf_Line_s* Dwarf_Line;\fP
  498. .DE
  499. Instances of \f(CWDwarf_Line\fP type are returned from a successful call 
  500. to the \f(CWdwarf_srclines()\fP function, and are used as descriptors for 
  501. queries about source lines.  The storage pointed to by these descriptors
  502. should be individually free'd, using \f(CWdwarf_dealloc()\fP with the 
  503. allocation type \f(CWDW_DLA_LINE\fP when no longer needed.
  504.  
  505. .DS
  506. \f(CWtypedef struct Dwarf_Global_s* Dwarf_Global;\fP
  507. .DE
  508. Instances of \f(CWDwarf_Global\fP type are returned from a successful 
  509. call to the \f(CWdwarf_get_globals()\fP function, and are used as 
  510. descriptors for queries about global names (pubnames).  The storage 
  511. pointed to by these descriptors should be individually free'd, using 
  512. \f(CWdwarf_dealloc()\fP with the allocation type \f(CWDW_DLA_GLOBAL\fP, 
  513. when no longer needed.
  514.  
  515. .DS
  516. \f(CWtypedef struct Dwarf_Weak_s* Dwarf_Weak;\fP
  517. .DE
  518. Instances of \f(CWDwarf_Weak\fP type are returned from a successful call 
  519. to the 
  520. SGI-specific \f(CWdwarf_get_weaks()\fP
  521. function, and are used as descriptors for 
  522. queries about weak names.  The storage pointed to by these descriptors 
  523. should be individually free'd, using \f(CWdwarf_dealloc()\fP with the 
  524. allocation type \f(CWDW_DLA_WEAK\fP when no longer needed.
  525.  
  526. .DS
  527. \f(CWtypedef struct Dwarf_Func_s* Dwarf_Func;\fP
  528. .DE
  529. Instances of \f(CWDwarf_Func\fP type are returned from a successful
  530. call to the 
  531. SGI-specific \f(CWdwarf_get_funcs()\fP
  532. function, and are used as 
  533. descriptors for queries about static function names.  
  534. The storage 
  535. pointed to by these descriptors should be individually free'd, using 
  536. \f(CWdwarf_dealloc()\fP with the allocation type \f(CWDW_DLA_FUNC\fP, 
  537. when no longer needed.
  538.  
  539. .DS
  540. \f(CWtypedef struct Dwarf_Type_s* Dwarf_Type;\fP
  541. .DE
  542. Instances of \f(CWDwarf_Type\fP type are returned from a successful call 
  543. to the 
  544. SGI-specific \f(CWdwarf_get_types()\fP
  545. function, and are used as descriptors for 
  546. queries about user defined types.  
  547. The storage pointed to by this descriptor 
  548. should be individually free'd, using \f(CWdwarf_dealloc()\fP with the 
  549. allocation type \f(CWDW_DLA_TYPENAME\fP when no longer needed.
  550.  
  551. .DS
  552. \f(CWtypedef struct Dwarf_Var_s* Dwarf_Var;\fP
  553. .DE
  554. Instances of \f(CWDwarf_Var\fP type are returned from a successful call 
  555. to the SGI-specfic \f(CWdwarf_get_vars()\fP
  556. function, and are used as descriptors for 
  557. queries about static variables.  
  558. The storage pointed to by this descriptor 
  559. should be individually free'd, using \f(CWdwarf_dealloc()\fP with the 
  560. allocation type \f(CWDW_DLA_VAR\fP when no longer needed.
  561.  
  562. .DS
  563. \f(CWtypedef struct Dwarf_Error_s* Dwarf_Error;\fP
  564. .DE
  565. This descriptor points to a structure that provides detailed information
  566. about errors detected by \f(CWlibdwarf\fP.  Users typically provide a
  567. location for \f(CWlibdwarf\fP to store this descriptor for the user to
  568. obtain more information about the error.  The storage pointed to by this
  569. descriptor should be free'd, using \f(CWdwarf_dealloc()\fP with the 
  570. allocation type \f(CWDW_DLA_ERROR\fP when no longer needed.
  571.  
  572. .DS
  573. \f(CWtypedef struct Dwarf_Attribute_s* Dwarf_Attribute;\fP
  574. .DE
  575. Instances of \f(CWDwarf_Attribute\fP type are returned from a successful 
  576. call to the \f(CWdwarf_attrlist()\fP, or \f(CWdwarf_attr()\fP functions, 
  577. and are used as descriptors for queries about attribute values.  The storage 
  578. pointed to by this descriptor should be individually free'd, using 
  579. \f(CWdwarf_dealloc()\fP with the allocation type \f(CWDW_DLA_ATTR\fP when 
  580. no longer needed.
  581.  
  582. .DS
  583. \f(CWtypedef struct Dwarf_Abbrev_s* Dwarf_Abbrev;\fP
  584. .DE
  585. An instance of a \f(CWDwarf_Abbrev\fP type is returned from a successful 
  586. call to \f(CWdwarf_get_abbrev()\fP, and is used as a descriptor for queries 
  587. about abbreviations in the .debug_abbrev section.  The storage pointed to 
  588. by this descriptor should be free'd, using \f(CWdwarf_dealloc()\fP with the
  589. allocation type \f(CWDW_DLA_ABBREV\fP when no longer needed.
  590.  
  591. .DS
  592. \f(CWtypedef struct Dwarf_Fde_s* Dwarf_Fde;\fP
  593. .DE
  594. Instances of \f(CWDwarf_Fde\fP type are returned from a successful call 
  595. to the \f(CWdwarf_get_fde_list()\fP, \f(CWdwarf_get_fde_for_die()\fP, or
  596. \f(CWdwarf_get_fde_at_pc()\fP functions, and are used as descriptors for 
  597. queries about frames descriptors.  The storage pointed to by these 
  598. descriptors should be individually free'd, using \f(CWdwarf_dealloc()\fP 
  599. with the allocation type \f(CWDW_DLA_FDE\fP when no longer needed.
  600.  
  601. .DS
  602. \f(CWtypedef struct Dwarf_Cie_s* Dwarf_Cie;\fP
  603. .DE
  604. Instances of \f(CWDwarf_Cie\fP type are returned from a successful call 
  605. to the \f(CWdwarf_get_fde_list()\fP function, and are used as descriptors 
  606. for queries about information that is common to several frames.  The 
  607. storage pointed to by this descriptor should be individually free'd, using 
  608. \f(CWdwarf_dealloc()\fP with the allocation type \f(CWDW_DLA_CIE\fP when 
  609. no longer needed.
  610.  
  611. .DS
  612. \f(CWtypedef struct Dwarf_Arange_s* Dwarf_Arange;\fP
  613. .DE
  614. Instances of \f(CWDwarf_Arange\fP type are returned from successful calls 
  615. to the \f(CWdwarf_get_aranges()\fP, or \f(CWdwarf_get_arange()\fP functions, 
  616. and are used as descriptors for queries about address ranges.  The storage 
  617. pointed to by this descriptor should be individually free'd, using 
  618. \f(CWdwarf_dealloc()\fP with the allocation type \f(CWDW_DLA_ARANGE\fP when 
  619. no longer needed.
  620.  
  621. .H 1 "Error Handling"
  622. The method for detection and disposition of error conditions that arise 
  623. during access of debugging information via \fIlibdwarf\fP is consistent
  624. across all \fIlibdwarf\fP functions that are capable of producing an
  625. error.  This section describes the method used by \fIlibdwarf\fP in
  626. notifying client programs of error conditions. 
  627.  
  628. .P
  629. Most functions within \fIlibdwarf\fP accept as an argument a pointer to 
  630. a \f(CWDwarf_Error\fP descriptor where a \f(CWDwarf_Error\fP descriptor 
  631. is stored if an error is detected by the function.  Routines in the client 
  632. program that provide this argument can query the \f(CWDwarf_Error\fP 
  633. descriptor to determine the nature of the error and perform appropriate 
  634. processing. 
  635.  
  636. .P
  637. A client program can also specify a function to be invoked upon detection 
  638. of an error at the time the library is initialized (see \f(CWdwarf_init()\fP). 
  639. When a \fIlibdwarf\fP routine detects an error, this function is called
  640. with two arguments: a code indicating the nature of the error and a pointer
  641. provided by the client at initialization (again see \f(CWdwarf_init()\fP).
  642. This pointer argument can be used to relay information between the error 
  643. handler and other routines of the client program.  A client program can 
  644. specify or change both the error handling function and the pointer argument 
  645. after initialization using \f(CWdwarf_seterrhand()\fP and 
  646. \f(CWdwarf_seterrarg()\fP.
  647.  
  648. .P
  649. In the case where \fIlibdwarf\fP functions are not provided a pointer
  650. to a \f(CWDwarf_Error\fP descriptor, and no error handling function was 
  651. provided at initialization, \fIlibdwarf\fP functions terminate execution 
  652. by calling \f(CWabort(3C)\fP.
  653.  
  654. .P
  655. The following lists the processing steps taken upon detection of an
  656. error:
  657. .AL 1
  658. .LI
  659. Check the \f(CWerror\fP argument; if not a \fINULL\fP pointer, allocate
  660. and initialize a \f(CWDwarf_Error\fP descriptor with information describing
  661. the error, place this descriptor in the area pointed to by \f(CWerror\fP,
  662. and return a value indicating an error condition.
  663. .LI
  664. If an \f(CWerrhand\fP argument was provided to \f(CWdwarf_init()\fP
  665. at initialization, call \f(CWerrhand()\fP passing it the error descriptor
  666. and the value of the \f(CWerrarg\fP argument provided to \f(CWdwarf_init()\fP. 
  667. If the error handling function returns, return a value indicating an 
  668. error condition.
  669. .LI
  670. Terminate program execution by calling \f(CWabort(3C)\fP.
  671. .LE
  672. .SP
  673.  
  674. In all cases, it is clear from the value returned from a function 
  675. that an error occured in executing the function, since
  676. DW_DLV_ERROR is returned.
  677. .P
  678. As can be seen from the above steps, the client program can provide
  679. an error handler at initialization, and still provide an \f(CWerror\fP
  680. argument to \fIlibdwarf\fP functions when it is not desired to have
  681. the error handler invoked.
  682.  
  683. .P
  684. If a \f(CWlibdwarf\fP function is called with invalid arguments, the 
  685. behaviour is undefined.  In particular, supplying a \f(CWNULL\fP pointer 
  686. to a \f(CWlibdwarf\fP function (except where explicitely permitted), 
  687. or pointers to invalid addresses or uninitialized data causes undefined 
  688. behaviour; the return value in such cases is undefined, and the function 
  689. may fail to invoke the caller supplied error handler or to return a 
  690. meaningful error number.  Implementations also may abort execution for 
  691. such cases.
  692.  
  693. .P
  694. .H 2 "Returned values in the functional interface"
  695. Values returned by \f(CWlibdwarf\fP functions to indicate 
  696. success and errors
  697. .nr aX \n(Fg+1
  698. are enumerated in Figure \n(aX.
  699. The \f(CWDW_DLV_NO_ENTRY\fP
  700. case is useful for functions 
  701. need to indicate that while there was no data to return
  702. there was no error either.
  703. For example, \f(CWdwarf_siblingof()\fP
  704. may return \f(CWDW_DLV_NO_ENTRY\fP to indicate that that there was
  705. no sibling to return.
  706. .DS
  707. .TS
  708. center box, tab(:);
  709. lfB cfB lfB 
  710. l c l.
  711. SYMBOLIC NAME:VALUE:MEANING
  712. _
  713. DW_DLV_ERROR:1:Error
  714. DW_DLV_OK:0:Successful call
  715. DW_DLV_NO_ENTRY:-1:No applicable value
  716. .TE
  717. .FG "Error Indications"
  718. .DE
  719. .P
  720. Each function in the interface that returns a value returns one
  721. of the integers in the above figure.
  722. .P
  723. If \f(CWDW_DLV_ERROR\fP is returned and a pointer to a \f(CWDwarf_Error\fP
  724. pointer is passed to the function, then a Dwarf_Error handle is returned
  725. thru the pointer. No other pointer value in the interface returns a value.
  726. .P
  727. If \f(CWDW_DLV_NO_ENTRY\fP is returned no pointer value in the
  728. interface returns a value.
  729. .P
  730. If \f(CWDW_DLV_NO_OK\fP is returned  the \f(CWDwarf_Error\fP pointer, if
  731. supplied, is not touched, but any other values to be returned
  732. through pointers are returned.
  733. .P
  734. Pointers passed to allow values to be returned thru them are 
  735. uniformly the last pointers
  736. in each argument list.
  737. .P
  738. All the interface functions are defined from the point of view of
  739. the writer-of-the-library (as is traditional for UN*X library
  740. documentation), not from the point of view of the user of the library.
  741. The caller might code:
  742. .P
  743. .DS
  744. Dwarf_Line line;
  745. Dwarf_Signed ret_loff;
  746. Dwarf_Error  err;
  747. int retval = dwarf_lineoff(line,&ret_loff,&err); 
  748. .DE
  749. for the function defined as
  750. .P
  751. .DS
  752. int dwarf_lineoff(Dwarf_Line line,Dwarf_Signed *return_lineoff,
  753.   Dwarf_Error* err);
  754. .DE
  755. and this document refers to the function as 
  756. returning the value thru *err or *return_lineoff or 
  757. uses the phrase "returns in
  758. the location pointed to by err".
  759. Sometimes other similar phrases are used.
  760.  
  761. .H 1 "Memory Management"
  762. Several of the functions that comprise \fIlibdwarf\fP return pointers 
  763. (opaque descriptors) to structures that have been dynamically allocated 
  764. by the library.  To aid in the management of dynamic memory, the function 
  765. \f(CWdwarf_dealloc()\fP is provided to free storage allocated as a result 
  766. of a call to a \fIlibdwarf\fP function.  This section describes the strategy 
  767. that should be taken by a client program in managing dynamic storage.
  768.  
  769. .H 2 "Read-only Properties"
  770. All pointers (opaque descriptors) returned by or as a result of a 
  771. \fIlibdwarf Consumer Library\fP 
  772. call should be assumed to point to read-only memory.  
  773. The results are undefined for \fIlibdwarf\fP  clients that attempt 
  774. to write to a region pointed to by a value returned by a 
  775. \fIlibdwarf Consumer Library\fP 
  776. call.
  777.  
  778. .H 2 "Storage Deallocation"
  779. In some cases the pointers returned by a \fIlibdwarf\fP call are pointers
  780. to data which is not free-able.  
  781. The library knows from the allocation type
  782. provided to it whether the space is freeable or not and will not free 
  783. inappropriately when \f(CWdwarf_dealloc()\fP is called.  
  784. So it is vital
  785. that \f(CWdwarf_dealloc()\fP be called with the proper allocation type.
  786. .P
  787. For most storage allocated by \fIlibdwarf\fP, the client can free the
  788. storage for reuse by calling \f(CWdwarf_dealloc()\fP, providing it with 
  789. the \f(CWDwarf_Debug\fP descriptor sepcifying the object for which the
  790. storage was allocated, a pointer to the area to be free-ed, and an 
  791. identifier that specifies what the pointer points to (the allocation
  792. type).  For example, to free a \f(CWDwarf_Die die\fP belonging the the
  793. object represented by \f(CWDwarf_Debug dbg\fP, allocated by a call to 
  794. \f(CWdwarf_siblingof()\fP, the call to \f(CWdwarf_dealloc()\fP would be:
  795. .DS
  796.     \f(CWdwarf_dealloc(dbg, die, DW_DLA_DIE);\fP
  797. .DE
  798.  
  799. To free storage allocated in the form of a list of pointers (opaque 
  800. descriptors), each member of the list should be deallocated, followed 
  801. by deallocation of the actual list itself.  The following code fragment 
  802. uses an invocation of \f(CWdwarf_attrlist()\fP as an example to illustrate 
  803. a technique that can be used to free storage from any \fIlibdwarf\fP 
  804. routine that returns a list:
  805. .DS
  806. \f(CWDwarf_Unsigned atcnt;
  807. Dwarf_Attribute *atlist;
  808. int errv;
  809.  
  810. if ((errv = dwarf_attrlist(somedie, &atlist,&atcnt, &error)) == DW_DLV_OK) {
  811.  
  812.         for (i = 0; i < atcnt; ++i) {
  813.                 /* use atlist[i] */
  814.                 dwarf_dealloc(dbg, atlist[i], DW_DLA_ATTR);
  815.         }
  816.         dwarf_dealloc(dbg, atlist, DW_DLA_LIST);
  817. }\fP
  818. .DE
  819.  
  820. The \f(CWDwarf_Debug\fP returned from \f(CWdwarf_init()\fP is the only
  821. dynamic storage that cannot be free'd, using \f(CWdwarf_dealloc()\fP.
  822. The function \f(CWdwarf_finish()\fP will deallocate all dynamic storage
  823. associated with an instance of a \f(CWDwarf_Debug\fP type.  In particular,
  824. it will deallocate all dynamically allocated space associated with the
  825. \f(CWDwarf_Debug\fP descriptor, and finally make the descriptor invalid.
  826.  
  827. .P
  828. The codes that identify the storage pointed to in calls to 
  829. .nr aX \n(Fg+1
  830. \f(CWdwarf_dealloc()\fP are described in figure \n(aX.
  831. .DS
  832. .TS
  833. center box, tab(:);
  834. lfB lfB 
  835. l l.
  836. IDENTIFIER:USED TO FREE 
  837. _
  838. DW_DLA_STRING           :     char* 
  839. DW_DLA_LOC              :     Dwarf_Loc 
  840. DW_DLA_LOCDESC          :     Dwarf_Locdesc 
  841. DW_DLA_ELLIST           :     Dwarf_Ellist (not used)
  842. DW_DLA_BOUNDS           :     Dwarf_Bounds (not used) 
  843. DW_DLA_BLOCK            :     Dwarf_Block 
  844. DW_DLA_DEBUG            :     Dwarf_Debug
  845. DW_DLA_DIE              :     Dwarf_Die
  846. DW_DLA_LINE             :     Dwarf_Line 
  847. DW_DLA_ATTR             :     Dwarf_Attribute 
  848. DW_DLA_TYPE             :     Dwarf_Type  (not used) 
  849. DW_DLA_SUBSCR           :     Dwarf_Subscr (not used) 
  850. DW_DLA_GLOBAL           :     Dwarf_Global 
  851. DW_DLA_ERROR            :     Dwarf_Error 
  852. DW_DLA_LIST             :     a list of opaque descriptors
  853. DW_DLA_LINEBUF          :     Dwarf_Line* (not used) 
  854. DW_DLA_ARANGE           :     Dwarf_Arange 
  855. DW_DLA_ABBREV           :     Dwarf_Abbrev 
  856. DW_DLA_FRAME_OP         :     Dwarf_Frame_Op 
  857. DW_DLA_CIE              :     Dwarf_Cie 
  858. DW_DLA_FDE              :     Dwarf_Fde
  859. DW_DLA_LOC_BLOCK        :     Dwarf_Loc Block
  860. DW_DLA_FRAME_BLOCK      :     Dwarf_Frame Block (not used) 
  861. DW_DLA_FUNC             :     Dwarf_Func 
  862. DW_DLA_TYPENAME         :     Dwarf_Type
  863. DW_DLA_VAR              :     Dwarf_Var
  864. DW_DLA_WEAK        :     Dwarf_Weak
  865. .TE
  866. .FG "Allocation/Deallocation Identifiers"
  867. .DE
  868.  
  869. .P
  870. .H 1 "Functional Interface"
  871. This section describes the functions available in the \fIlibdwarf\fP
  872. library.  Each function description includes its definition, followed 
  873. by one or more paragraph describing the function's operation.
  874.  
  875. .P
  876. The following sections describe these functions.
  877.  
  878. .H 2 "Initialization Operations"
  879. These functions are concerned with preparing an object file for subsequent
  880. access by the functions in \fIlibdwarf\fP and with releasing allocated
  881. resources when access is complete. 
  882.  
  883. .DS
  884. \f(CWint dwarf_init(
  885.         int fd,
  886.         Dwarf_Unsigned access,
  887.         Dwarf_Handler errhand, 
  888.         Dwarf_Ptr errarg,
  889.     Dwarf_Debug * dbg,
  890.         Dwarf_Error *error)\fP
  891. .DE
  892. When it returns \f(CWDW_DLV_OK\fP,
  893. the function \f(CWdwarf_init()\fP returns  thru
  894. \f(CWdbg\fP a \f(CWDwarf_Debug\fP descriptor 
  895. that represents a handle for accessing debugging records associated with 
  896. the open file descriptor \f(CWfd\fP.  
  897. \f(CWDW_DLV_NO_ENTRY\fP is returned if the object
  898. does not contain DWARF debugging information.
  899. \f(CWDW_DLV_ERROR\fP is returned if
  900. an error occurred.
  901. The 
  902. \f(CWaccess\fP argument indicates what access is allowed for the section. 
  903. The \f(CWDW_DLC_READ\fP parameter is valid
  904. for read access (only read access is defined or discussed in this
  905. document).  
  906. The \f(CWerrhand\fP 
  907. argument is a pointer to a function that will be invoked whenever an error 
  908. is detected as a result of a \fIlibdwarf\fP operation.  The \f(CWerrarg\fP 
  909. argument is passed as an argument to the \f(CWerrhand\fP function.  
  910. The file 
  911. descriptor associated with the \f(CWfd\fP argument must refer to an ordinary 
  912. file (i.e. not a pipe, socket, device, /proc entry, etc.), be opened with 
  913. the at least as much permission as specified by the \f(CWaccess\fP argument, 
  914. and cannot be closed or used as an argument to any system calls by the 
  915. client until after \f(CWdwarf_finish()\fP is called.  
  916. The seek position of 
  917. the file associated with \f(CWfd\fP is undefined upon return of 
  918. \f(CWdwarf_init()\fP.
  919.  
  920. Since \f(CWdwarf_init()\fP uses the same error handling processing as other 
  921. \fIlibdwarf\fP functions (see \fIError Handling\fP above), client programs 
  922. will generally supply an \f(CWerror\fP parameter to bypass the default actions 
  923. during initialization unless the default actions are appropriate. 
  924.  
  925. .DS
  926. \f(CWint dwarf_elf_init(
  927.         Elf * elf_file_pointer,
  928.         Dwarf_Unsigned access,
  929.         Dwarf_Handler errhand, 
  930.         Dwarf_Ptr errarg,
  931.     Dwarf_Debug * dbg,
  932.         Dwarf_Error *error)\fP
  933. .DE
  934. The function \f(CWdwarf_elf_init()\fP is identical to \f(CWdwarf_init()\fP 
  935. except that an open \f(CWElf *\fP pointer is passed instead of a file 
  936. descriptor.  
  937. In systems supporting \f(CWELF\fP object files this may be 
  938. more space or time-efficient than using \f(CWdwarf_init()\fP.
  939. The client is allowed to use the \f(CWElf *\fP pointer
  940. for its own purposes without restriction during the time the 
  941. \f(CWDwarf_Debug\fP
  942. is open, except that the client should not  \f(CWelf_end()\fP the
  943. pointer till after  \f(CWdwarf_finish\fP is called.
  944.  
  945. .DS
  946. \f(CWint dwarf_get_elf(
  947.         Dwarf_Debug dbg,
  948.         Elf **      elf,
  949.         Dwarf_Error *error)\fP
  950. .DE
  951. When it returns \f(CWDW_DLV_OK\fP,
  952. the function \f(CWdwarf_get_elf()\fP returns thru the
  953. pointer \f(CWelf\fP the \f(CWElf *\fP handle
  954. used to access the object represented by the \f(CWDwarf_Debug\fP
  955. descriptor \f(CWdbg\fP.  It returns \f(CWDW_DLV_ERROR\fP on error.
  956.  
  957. This function is not meaningful for a system that does not used the
  958. Elf format for objects.
  959.  
  960. .DS
  961. \f(CWint dwarf_finish(
  962.         Dwarf_Debug dbg,
  963.     Dwarf_Error *error)\fP
  964. .DE
  965. The function
  966. \f(CWdwarf_finish()\fP releases all \fILibdwarf\fP internal resources 
  967. associated with the descriptor \f(CWdbg\fP, and invalidates \f(CWdbg\fP.  
  968. It returns \f(CWDW_DLV_ERROR\fP if there is an error during the
  969. finishing operation.  It returns \f(CWDW_DLV_OK\fP 
  970. for a successful operation.
  971.  
  972. .H 2 "Debugging Information Entry Delivery Operations"
  973. These functions are concerned with accessing debugging information 
  974. entries. 
  975.  
  976. .H 3 "Debugging Information Entry Debugger Delivery Operations"
  977.  
  978. .DS
  979. \f(CWint dwarf_next_cu_header(
  980.         Dwarf_debug dbg,
  981.         Dwarf_Unsigned *cu_header_length,
  982.         Dwarf_Half     *version_stamp,
  983.         Dwarf_Unsigned *abbrev_offset,
  984.         Dwarf_Half     *address_size,
  985.         Dwarf_Unsigned *next_cu_header,
  986.         Dwarf_Error    *error);
  987. .DE
  988. The function
  989. \f(CWdwarf_next_cu_header()\fP returns \f(CWDW_DLV_ERROR\fP 
  990. if it fails, and
  991. \f(CWDW_DLV_OK\fP if it succeeds.
  992. .P
  993. If it succeeds, \f(CW*next_cu_header\fP is set to
  994. the offset in the .debug_info section of the next 
  995. compilation-unit header if it succeeds.  On reading the last 
  996. compilation-unit header in the .debug_info section it contains 
  997. the size of the .debug_info section.
  998. The next call to 
  999. \f(CWdwarf_next_cu_header()\fP returns \f(CWDW_DLV_NO_ENTRY\fP
  1000. without reading a 
  1001. compilation-unit or setting \f(CW*next_cu_header\fP.  
  1002. Subsequent calls to \f(CWdwarf_next_cu_header()\fP 
  1003. repeat the cycle by reading the first compilation-unit and so on.  
  1004. .P
  1005. The other 
  1006. values returned through pointers are the values in the compilation-unit 
  1007. header.  If any of \f(CWcu_header_length\fP, \f(CWversion_stamp\fP,
  1008. \f(CWabbrev_offset\fP, or \f(CWaddress_size\fP is \f(CWNULL\fP, the 
  1009. argument is ignored (meaning it is not an error to provide a 
  1010. \f(CWNULL\fP pointer).
  1011.  
  1012. .DS
  1013. \f(CWint dwarf_siblingof(
  1014.         Dwarf_Debug dbg, 
  1015.         Dwarf_Die die, 
  1016.     Dwarf_Die *return_sib,
  1017.         Dwarf_Error *error)\fP
  1018. .DE
  1019. The function \f(CWdwarf_siblingof()\fP 
  1020. returns \f(CWDW_DLV_ERROR\fP and sets the \f(CWerror\fP pointer on error.
  1021. If there is no sibling it returns \f(CWDW_DLV_NO_ENTRY\fP.
  1022. When it succeeds,
  1023. \f(CWdwarf_siblingof()\fP returns
  1024. \f(CWDW_DLV_OK\fP  and sets \f(CW*return_sib\fP to the \f(CWDwarf_Die\fP 
  1025. descriptor of the sibling of \f(CWdie\fP.
  1026. If \f(CWdie\fP is \fINULL\fP, the \f(CWDwarf_Die\fP descriptor of the
  1027. first die in the compilation-unit is returned.  
  1028. This die has the
  1029. \f(CWDW_TAG_compile_unit\fP tag.
  1030.  
  1031. .DS
  1032. \f(CWint dwarf_child(
  1033.         Dwarf_Die die, 
  1034.     Dwarf_Die *return_kid,
  1035.         Dwarf_Error *error)\fP
  1036. .DE
  1037. The function \f(CWdwarf_child()\fP 
  1038. returns \f(CWDW_DLV_ERROR\fP and sets the \f(CWerror\fP die on error.
  1039. If there is no child it returns \f(CWDW_DLV_NO_ENTRY\fP.
  1040. When it succeeds,
  1041. \f(CWdwarf_child()\fP returns 
  1042. \f(CWDW_DLV_OK\fP and sets \f(CW*return_kid\fP
  1043. to the \f(CWDwarf_Die\fP descriptor 
  1044. of the first child of \f(CWdie\fP.
  1045. The function 
  1046. \f(CWdwarf_siblingof()\fP can be used with the return value of 
  1047. \f(CWdwarf_child()\fP to access the other children of \f(CWdie\fP. 
  1048.  
  1049. .DS
  1050. \f(CWint dwarf_offdie(
  1051.         Dwarf_Debug dbg,
  1052.         Dwarf_Off offset, 
  1053.     Dwarf_Die *return_die,
  1054.         Dwarf_Error *error)\fP
  1055. .DE
  1056. The function \f(CWdwarf_offdie()\fP 
  1057. returns \f(CWDW_DLV_ERROR\fP and sets the \f(CWerror\fP die on error.
  1058. When it succeeds,
  1059. \f(CWdwarf_offdie()\fP returns
  1060. \f(CWDW_DLV_OK\fP and sets \f(CW*return_die\fP
  1061. to the
  1062. the \f(CWDwarf_Die\fP 
  1063. descriptor of the debugging information entry at \f(CWoffset\fP in 
  1064. the section containing debugging information entries i.e the .debug_info
  1065. section.  
  1066. It is the user's 
  1067. responsibility to make sure that \f(CWoffset\fP is the start of a valid 
  1068. debugging information entry.  The result of passing it an invalid 
  1069. offset could be chaos.
  1070.  
  1071. .\"#if 0
  1072. .\".H 3 "Debugging Entry Delivery High-level Operations"
  1073. .\"The following "higher level" operations are typically not used by 
  1074. .\"debuggers or DWARF prettyprinters.  A disassembler (for example) 
  1075. .\"might find them useful.
  1076. .\"
  1077. .\".DS
  1078. .\"\f(CWDwarf_Die dwarf_pcfile(
  1079. .\"        Dwarf_Debug dbg, 
  1080. .\"        Dwarf_Addr pc, 
  1081. .\"        Dwarf_Error *error)\fP
  1082. .\".DE
  1083. .\"The function \f(CWdwarf_pcfile()\fP returns the \f(CWDwarf_Die\fP 
  1084. .\"descriptor of the compilation unit debugging information entry that 
  1085. .\"contains the address of \f(CWpc\fP.  It returns \fINULL\fP if no 
  1086. .\"entry exists or an error occurred.  Currently compilation unit 
  1087. .\"debugging information entries are defined as those having a tag of: 
  1088. .\"\f(CWDW_TAG_compile_unit\fP.  This function is currently unimplemented.
  1089. .\"
  1090. .\".DS
  1091. .\"\f(CWDwarf_Die dwarf_pcsubr(
  1092. .\"        Dwarf_Debug dbg, 
  1093. .\"        Dwarf_Addr pc, 
  1094. .\"        Dwarf_Error *error)\fP
  1095. .\".DE
  1096. .\"The function
  1097. .\"\f(CWdwarf_pcsubr()\fP returns the \f(CWDwarf_Die\fP descriptor of the 
  1098. .\"subroutine debugging entry that contains the address of \f(CWpc\fP.  It 
  1099. .\"returns \fINULL\fP if no entry exists or an error occurred.  Currently 
  1100. .\"subroutine debugging information entries are defined as those having a 
  1101. .\"tag of: \f(CWDW_TAG_subprogram\fP, or \f(CWTAG_inlined_subroutine\fP.
  1102. .\"This function is currently unimplemented.
  1103. .\"
  1104. .\".DS
  1105. .\"\f(CWDwarf_Die dwarf_pcscope(
  1106. .\"        Dwarf_Debug dbg, 
  1107. .\"        Dwarf_Addr pc, 
  1108. .\"        Dwarf_Error *error)\fP
  1109. .\".DE
  1110. .\"The function
  1111. .\"\f(CWdwarf_pcscope()\fP returns the \f(CWDwarf_Die\fP descriptor for 
  1112. .\"the debugging information entry that represents the innermost enclosing 
  1113. .\"scope containing \f(CWpc\fP, or \fINULL\fP if no entry exists or an 
  1114. .\"error occurred. Debugging information entries that represent a \fIscope\fP 
  1115. .\"are those containing a low pc attribute and either a high pc or byte 
  1116. .\"size attribute that deliniates a range. For example: a debugging information 
  1117. .\"entry for a lexical block is considered one having a scope whereas a 
  1118. .\"debugging information entry for a label is not.  This function is
  1119. .\"currently unimplemented.
  1120. .\"#endif
  1121.  
  1122.  
  1123. .H 2 "Debugging Information Entry Query Operations"
  1124. These queries return specific information about debugging information 
  1125. entries or a descriptor that can be used on subsequent queries when 
  1126. given a \f(CWDwarf_Die\fP descriptor.  Note that some operations are 
  1127. specific to debugging information entries that are represented by a 
  1128. \f(CWDwarf_Die\fP descriptor of a specific type. 
  1129. For example, not all 
  1130. debugging information entries contain an attribute having a name, so 
  1131. consequently, a call to \f(CWdwarf_diename()\fP using a \f(CWDwarf_Die\fP 
  1132. descriptor that does not have a name attribute will return
  1133. \f(CWDW_DLV_NO_ENTRY\fP.
  1134. This is not an error, i.e. calling a function that needs a specific
  1135. attribute is not an error for a die that does not contain that specific
  1136. attribute.
  1137. .P
  1138. There are several methods that can be used to obtain the value of an
  1139. attribute in a given die:
  1140. .AL 1
  1141. .LI
  1142. Call \f(CWdwarf_hasattr()\fP to determine if the debugging information
  1143. entry has the attribute of interest prior to issuing the query for
  1144. information about the attribute.
  1145.  
  1146. .LI
  1147. Supply an \f(CWerror\fP argument, and check its value after the call to 
  1148. a query indicates an unsucessful return, to determine the nature of the 
  1149. problem.  The \f(CWerror\fP argument will indicate whether an error occurred, 
  1150. or the specific attribute needed was missing in that die.
  1151.  
  1152. .LI
  1153. Arrange to have an error handling function invoked upon detection of an 
  1154. error (see \f(CWdwarf_init()\fP).
  1155.  
  1156. .LI
  1157. Call \f(CWdwarf_attrlist()\fP and iterate through the returned list of
  1158. attributes, dealing with each one as appropriate.
  1159. .LE
  1160. .P
  1161.  
  1162. .DS
  1163. \f(CWint dwarf_tag(
  1164.         Dwarf_Die die, 
  1165.     Dwarf_Half *tagval,
  1166.         Dwarf_Error *error)\fP
  1167. .DE
  1168. The function \f(CWdwarf_tag()\fP returns the \fItag\fP of \f(CWdie\fP
  1169. thru the pointer  \f(CWtagval\fP if it succeeds. 
  1170. It returns \f(CWDW_DLV_OK\fP if it succeeds.
  1171. It returns \f(CWDW_DLV_ERROR\fP on error.
  1172.  
  1173. .DS
  1174. \f(CWint dwarf_dieoffset(
  1175.         Dwarf_Die die, 
  1176.     Dwarf_Off * return_offset,
  1177.         Dwarf_Error *error)\fP
  1178. .DE
  1179. When it succeeds,
  1180. the function \f(CWdwarf_dieoffset()\fP returns 
  1181. \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP
  1182. to the position of \f(CWdie\fP 
  1183. in the section containing debugging information entries.  In other words,
  1184. it sets \f(CWreturn_offset\fP 
  1185. to the offset of the start of the debugging information entry
  1186. described by \f(CWdie\fP in the section containing die's i.e .debug_info.  
  1187. It returns \f(CWDW_DLV_ERROR\fP on error.
  1188.  
  1189. .DS
  1190. \f(CWint dwarf_die_CU_offset(
  1191.         Dwarf_Die die,
  1192.       Dwarf_Off *return_offset,
  1193.         Dwarf_Error *error)\fP
  1194. .DE
  1195. The function \f(CWdwarf_die_CU_offset()\fP is similar to 
  1196. \f(CWdwarf_dieoffset()\fP, except that it puts the offset of the DIE 
  1197. represented by the \f(CWDwarf_Die\fP \f(CWdie\fP, from the 
  1198. start of the compilation-unit that it belongs to rather than the start 
  1199. of .debug_info.  
  1200.  
  1201.  
  1202. .DS
  1203. \f(CWint dwarf_diename(
  1204.         Dwarf_Die die, 
  1205.     char  ** return_name,
  1206.         Dwarf_Error *error)\fP
  1207. .DE
  1208. When it succeeds,
  1209. the function \f(CWdwarf_diename()\fP returns
  1210. \f(CWDW_DLV_OK\fP and sets \f(CW*return_name\fP
  1211. to
  1212. a pointer to a
  1213. null-terminated string of characters that represents the name
  1214. attribute of \f(CWdie\fP.
  1215. It returns \f(CWDW_DLV_NO_ENTRY\fP if \f(CWdie\fP does not have a name attribute.
  1216. It returns \f(CWDW_DLV_ERROR\fP if
  1217. an error occurred.  
  1218. The storage pointed to by a successful return of 
  1219. \f(CWdwarf_diename()\fP should be free'd using the allocation type
  1220. \f(CWDW_DLA_STRING\fP when no longer of interest (see 
  1221. \f(CWdwarf_dealloc()\fP).
  1222.  
  1223. .DS
  1224. \f(CWint dwarf_attrlist(
  1225.         Dwarf_Die die, 
  1226.         Dwarf_Attribute** attrbuf, 
  1227.     Dwarf_Signed *attrcount,
  1228.         Dwarf_Error *error)\fP
  1229. .DE
  1230. When it returns \f(CWDW_DLV_OK\fP,
  1231. the function \f(CWdwarf_attrlist()\fP sets \f(CWattrbuf\fP to point 
  1232. to an array of \f(CWDwarf_Attribute\fP descriptors corresponding to
  1233. each of the attributes in die, and returns the number of elements in 
  1234. the array thru \f(CWattrcount\fP.  
  1235. \f(CWDW_DLV_NO_ENTRY\fP is returned if the count is zero (no 
  1236. \f(CWattrbuf\fP is allocated in this case).
  1237. \f(CWDW_DLV_ERROR\fP is returned on error.
  1238. On a successful return from \f(CWdwarf_attrlist()\fP, each of the
  1239. \f(CWDwarf_Attribute\fP descriptors should be individually free'd using 
  1240. \f(CWdwarf_dealloc()\fP with the allocation type \f(CWDW_DLA_ATTR\fP, 
  1241. followed by free-ing the list pointed to by \f(CW*attrbuf\fP using
  1242. \f(CWdwarf_dealloc()\fP with the allocation type \f(CWDW_DLA_LIST\fP, 
  1243. when no longer of interest (see \f(CWdwarf_dealloc()\fP).
  1244.  
  1245. Freeing the attrlist:
  1246. .in +2
  1247. .DS
  1248. \f(CWDwarf_Unsigned atcnt;
  1249. Dwarf_Attribute *atlist;
  1250. int errv;
  1251.  
  1252. if ((errv = dwarf_attrlist(somedie, &atlist,&atcnt, &error)) == DW_DLV_OK) {
  1253.  
  1254.         for (i = 0; i < atcnt; ++i) {
  1255.                 /* use atlist[i] */
  1256.                 dwarf_dealloc(dbg, atlist[i], DW_DLA_ATTR);
  1257.         }
  1258.         dwarf_dealloc(dbg, atlist, DW_DLA_LIST);
  1259. }\fP
  1260. .DE
  1261. .in -2
  1262. .P
  1263. .DS
  1264. \f(CWint dwarf_hasattr(
  1265.         Dwarf_Die die, 
  1266.         Dwarf_Half attr, 
  1267.     Dwarf_Bool *return_bool,
  1268.         Dwarf_Error *error)\fP
  1269. .DE
  1270. When it succeeds, the
  1271. function \f(CWdwarf_hasattr()\fP returns \f(CWDW_DLV_OK\fP
  1272. and sets \f(CW*return_bool\fP to \fInon-zero\fP if 
  1273. \f(CWdie\fP has the attribute \f(CWattr\fP and \fIzero\fP otherwise.
  1274. If it fails, it returns \f(CWDW_DLV_ERROR\fP.
  1275.  
  1276. .DS
  1277. \f(CWint dwarf_attr(
  1278.         Dwarf_Die die, 
  1279.         Dwarf_Half attr, 
  1280.     Dwarf_Attribute *return_attr,
  1281.         Dwarf_Error *error)\fP
  1282. .DE
  1283. When it returns \f(CWDW_DLV_OK\fP,
  1284. the function \f(CWdwarf_attr()\fP
  1285. sets 
  1286. \f(CW*return_attr\fP to the  \f(CWDwarf_Attribute\fP 
  1287. descriptor of \f(CWdie\fP having the attribute \f(CWattr\fP.
  1288. It returns \f(CDW_DLV_NO_ENTRY\fP if \f(CWattr\fP is not contained 
  1289. in \f(CWdie\fP. 
  1290. It returns \f(CDW_DLV_ERROR\fP if an error occurred.
  1291.  
  1292. .\"#if 0
  1293. .\".DS
  1294. .\"\f(CWDwarf_Locdesc* dwarf_stringlen(
  1295. .\"        Dwarf_Die die, 
  1296. .\"        Dwarf_Error *error)\fP
  1297. .\".DE
  1298. .\"The function \f(CWdwarf_stringlen()\fP returns a pointer to a 
  1299. .\"\f(CWDwarf_Locdesc\fP with one Locdesc entry that when evaluated,
  1300. .\"yields the length of the string represented by \f(CWdie\fP.  It
  1301. .\"returns \f(CWNULL\fP if \f(CWdie\fP does not contain a string length 
  1302. .\"attribute or the string length attribute is not a location-description 
  1303. .\"or an error occurred. The address range of the list is set to 0 thru 
  1304. .\"the highest possible address if a loclist pointer is returned.  The 
  1305. .\"storage pointed to by a successful return of \f(CWdwarf_stringlen()\fP 
  1306. .\"should be free'd when no longer of interest (see \f(CWdwarf_dealloc()\fP).
  1307. .\"This function is currently unimplemented.
  1308. .\"#endif
  1309.  
  1310. .\"#if 0
  1311. .\".DS
  1312. .\"\f(CWDwarf_Signed dwarf_subscrcnt(
  1313. .\"        Dwarf_Die die, 
  1314. .\"        Dwarf_Error *error)\fP
  1315. .\".DE
  1316. .\"The function \f(CWdwarf_subscrcnt()\fP returns the number of subscript 
  1317. .\"die's that are owned by the array type represented by \f(CWdie\fP.  It
  1318. .\"returns \f(CWDW_DLV_NOCOUNT\fP on error.  This function is currently
  1319. .\"unimplemented.
  1320. .\"
  1321. .\".DS
  1322. .\"\f(CWDwarf_Die dwarf_nthsubscr(
  1323. .\"        Dwarf_Die die, 
  1324. .\"        Dwarf_Unsigned ssndx, 
  1325. .\"        Dwarf_Error *error)\fP
  1326. .\".DE
  1327. .\"The function \f(CWdwarf_nthsubscr()\fP returns a \f(CWDwarf_Die\fP 
  1328. .\"descriptor that describes the \f(CWssndx\fP subscript of the array 
  1329. .\"type debugging information entry represented by \f(CWdie\fP, where 
  1330. .\"\fI1\fP is the first member.  It returns \fINULL\fP if \f(CWdie\fP 
  1331. .\"does not have an \f(CWssndx\fP subscript, or an error occurred.  
  1332. .\"This function is currently unimplemented.
  1333. .\"#endif
  1334.  
  1335. .DS
  1336. \f(CWint dwarf_lowpc(
  1337.         Dwarf_Die     die, 
  1338.     Dwarf_Addr  * return_lowpc,
  1339.         Dwarf_Error * error)\fP
  1340. .DE
  1341. The function \f(CWdwarf_lowpc()\fP returns
  1342. \f(CWDW_DLV_OK\fP and sets \f(CW*return_lowpc\fP
  1343. to the low program counter 
  1344. value associated with the \f(CWdie\fP descriptor if \f(CWdie\fP 
  1345. represents a debugging information entry with this attribute.  
  1346. It returns \f(CWDW_DLV_NO_ENTRY\fP if \f(CWdie\fP does not have this 
  1347. attribute. 
  1348. It returns \f(CWDW_DLV_ERROR\fP if an error occurred. 
  1349.  
  1350. .DS
  1351. \f(CWint dwarf_highpc(
  1352.         Dwarf_Die die, 
  1353.     Dwarf_Addr  * return_highpc,
  1354.         Dwarf_Error *error)\fP
  1355. .DE
  1356. The function \f(CWdwarf_highpc()\fP returns 
  1357. \f(CWDW_DLV_OK\fP and sets \f(CW*return_highpc\fP
  1358. the high program counter 
  1359. value associated with the \f(CWdie\fP descriptor if \f(CWdie\fP 
  1360. represents a debugging information entry with this attribute.  
  1361. It returns \f(CWDW_DLV_NO_ENTRY\fP if \f(CWdie\fP does not have this 
  1362. attribute. 
  1363. It returns \f(CWDW_DLV_ERROR\fP if an error occurred. 
  1364.  
  1365. .DS
  1366. \f(CWDwarf_Signed dwarf_bytesize(
  1367.         Dwarf_Die        die, 
  1368.     Dwarf_Unsigned  *return_size,
  1369.         Dwarf_Error     *error)\fP
  1370. .DE
  1371. When it succeeds,
  1372. \f(CWdwarf_bytesize()\fP returns 
  1373. \f(CWDW_DLV_OK\fP and sets \f(CW*return_size\fP
  1374. to the number of bytes 
  1375. needed to contain an instance of the aggregate debugging information 
  1376. entry represented by \f(CWdie\fP.  
  1377. It returns \f(CWDW_DLV_NO_ENTRY\fP if 
  1378. \f(CWdie\fP does not contain the byte size attribute \f(CWDW_AT_byte_size\fP.
  1379. It returns \f(CWDW_DLV_ERROR\fP if 
  1380. an error occurred.
  1381.  
  1382. .\"#if 0
  1383. .\".DS
  1384. .\"\f(CWDwarf_Bool dwarf_isbitfield(
  1385. .\"        Dwarf_Die die, 
  1386. .\"        Dwarf_Error *error)\fP
  1387. .\".DE
  1388. .\"The function \f(CWdwarf_isbitfield()\fP returns \fInon-zero\fP if 
  1389. .\"\f(CWdie\fP is a descriptor for a debugging information entry that 
  1390. .\"represents a bit field member.  It returns \fIzero\fP if \f(CWdie\fP 
  1391. .\"is not associated with a bit field member.  This function is currently
  1392. .\"unimplemented.
  1393. .\"#endif
  1394.  
  1395. .DS
  1396. \f(CWint dwarf_bitsize(
  1397.         Dwarf_Die die, 
  1398.     Dwarf_Unsigned  *return_size,
  1399.         Dwarf_Error *error)\fP
  1400. .DE
  1401. When it succeeds,
  1402. \f(CWdwarf_bitsize()\fP returns 
  1403. \f(CWDW_DLV_OK\fP and sets \f(CW*return_size\fP
  1404. to the number of 
  1405. bits 
  1406. occupied by the bit field value that is an attribute of the given
  1407. die.  
  1408. It returns \f(CWDW_DLV_NO_ENTRY\fP if \f(CWdie\fP does not 
  1409. contain the bit size attribute \f(CWDW_AT_bit_size\fP.
  1410. It returns \f(CWDW_DLV_ERROR\fP if 
  1411. an error occurred.
  1412.  
  1413. .DS
  1414. \f(CWint dwarf_bitoffset(
  1415.         Dwarf_Die die, 
  1416.     Dwarf_Unsigned  *return_size,
  1417.         Dwarf_Error *error)\fP
  1418. .DE
  1419. When it succeeds,
  1420. \f(CWdwarf_bitoffset()\fP returns 
  1421. \f(CWDW_DLV_OK\fP and sets \f(CW*return_size\fP
  1422. to the number of bits 
  1423. to the left of the most significant bit of the bit field value. 
  1424. It returns \f(CWDW_DLV_NO_ENTRY\fP if \f(CWdie\fP does not contain the 
  1425. bit offset attribute \f(CWDW_AT_bit_offset\fP.
  1426. It returns \f(CWDW_DLV_ERROR\fP if 
  1427. an error occurred.
  1428.  
  1429. .DS
  1430. \f(CWint dwarf_srclang(
  1431.         Dwarf_Die die, 
  1432.     Dwarf_Unsigned  *return_lang,
  1433.         Dwarf_Error *error)\fP
  1434. .DE
  1435. When it succeeds,
  1436. \f(CWdwarf_srclang()\fP returns
  1437. \f(CWDW_DLV_OK\fP and sets \f(CW*return_lang\fP
  1438. to
  1439. a code indicating the 
  1440. source language of the compilation unit represented by the descriptor 
  1441. \f(CWdie\fP.  
  1442. It returns \f(CWDW_DLV_NO_ENTRY\fP if \f(CWdie\fP does not 
  1443. represent a source file debugging information entry (i.e. contain the 
  1444. attribute \f(CWDW_AT_language\fP).
  1445. It returns \f(CWDW_DLV_ERROR\fP if 
  1446. an error occurred.
  1447.  
  1448. .DS
  1449. \f(CWint dwarf_arrayorder(
  1450.         Dwarf_Die die, 
  1451.     Dwarf_Unsigned  *return_order,
  1452.         Dwarf_Error *error)\fP
  1453. .DE
  1454. When it succeeds,
  1455. \f(CWdwarf_arrayorder()\fP returns
  1456. \f(CWDW_DLV_OK\fP and sets \f(CW*return_order\fP
  1457. a code indicating 
  1458. the ordering of the array represented by the descriptor \f(CWdie\fP.
  1459. It returns \f(CWDW_DLV_NO_ENTRY\fP if \f(CWdie\fP does not contain the
  1460. array order attribute \f(CWDW_AT_ordering\fP.
  1461. It returns \f(CWDW_DLV_ERROR\fP if 
  1462. an error occurred.
  1463.  
  1464. .H 2 "Attribute Form Queries"
  1465. Based on the attribute's form, these operations are concerned with 
  1466. returning uninterpreted attribute data.  Since it is not always 
  1467. obvious from the return value of these functions if an error occurred, 
  1468. one should always supply an \f(CWerror\fP parameter or have arranged 
  1469. to have an error handling function invoked (see \f(CWdwarf_init()\fP)
  1470. to determine the validity of the returned value and the nature of any 
  1471. errors that may have occurred.
  1472.  
  1473. A \f(CWDwarf_Attribute\fP descriptor describes an attribute of a
  1474. specific die.  Thus, each \f(CWDwarf_Attribute\fP descriptor is
  1475. implicitly associated with a specific die.
  1476.  
  1477. .DS
  1478. \f(CWnt dwarf_hasform(
  1479.         Dwarf_Attribute attr, 
  1480.         Dwarf_Half form, 
  1481.         Dwarf_Bool  *return_hasform,
  1482.         Dwarf_Error *error)\fP
  1483. .DE
  1484. The function \f(CWdwarf_hasform()\fP returns 
  1485. \f(CWDW_DLV_OK\fP and  and puts a 
  1486. \fInon-zero\fP
  1487.  value in the 
  1488. \f(CW*return_hasform\fP boolean if the 
  1489. attribute represented by the \f(CWDwarf_Attribute\fP descriptor 
  1490. \f(CWattr\fP has the attribute form \f(CWform\fP.  
  1491. If the attribute does not have that form \fIzero\fP
  1492. is put into \f(CW*return_hasform\fP. 
  1493. \f(CWDW_DLV_ERROR\fP is returned on error.
  1494.  
  1495. .DS
  1496. \f(CWint dwarf_whatform(
  1497.         Dwarf_Attribute attr,
  1498.         Dwarf_Half     *return_form,
  1499.         Dwarf_Error *error)\fP
  1500. .DE
  1501. When it succeeds,
  1502. \f(CWdwarf_whatform()\fP returns 
  1503. \f(CWDW_DLV_OK\fP and sets \f(CW*return_form\fP
  1504. to the attribute form code of 
  1505. the attribute represented by the \f(CWDwarf_Attribute\fP descriptor 
  1506. \f(CWattr\fP.  
  1507. It returns  \f(CWDW_DLV_ERROR\fP  on error.
  1508.  
  1509. .DS
  1510. \f(CWint dwarf_whatattr(
  1511.         Dwarf_Attribute attr,
  1512.         Dwarf_Half     *return_attr,
  1513.         Dwarf_Error *error)\fP
  1514. .DE
  1515. When it succeeds,
  1516. \f(CWdwarf_whatattr()\fP returns
  1517. \f(CWDW_DLV_OK\fP and sets \f(CW*return_attr\fP
  1518. to the attribute code 
  1519. represented by the \f(CWDwarf_Attribute\fP descriptor \f(CWattr\fP.  
  1520. It returns  \f(CWDW_DLV_ERROR\fP  on error.
  1521.  
  1522. .DS
  1523. \f(CWint dwarf_formref(
  1524.         Dwarf_Attribute attr, 
  1525.     Dwarf_Off     *return_offset,
  1526.         Dwarf_Error *error)\fP
  1527. .DE
  1528. When it succeeds,
  1529. \f(CWdwarf_formref()\fP returns 
  1530. \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP
  1531. to the  offset
  1532. represented by the descriptor \f(CWattr\fP if the form of the attribute 
  1533. belongs to the \f(CWREFERENCE\fP class.  It is an error for the form to
  1534. not belong to this class.  It returns \f(CWDW_DLV_ERROR\fP on error.
  1535.  
  1536. .DS
  1537. \f(CWint dwarf_formaddr(
  1538.         Dwarf_Attribute attr, 
  1539.         Dwarf_Addr    * return_addr,
  1540.         Dwarf_Error *error)\fP
  1541. .DE
  1542. When it succeeds,
  1543. \f(CWdwarf_formaddr()\fP returns 
  1544. \f(CWDW_DLV_OK\fP and sets \f(CW*return_addr\fP
  1545. to
  1546. the address 
  1547. represented by the descriptor \f(CWattr\fP if the form of the attribute
  1548. belongs to the \f(CWADDRESS\fP class.  
  1549. It is an error for the form to
  1550. not belong to this class.  
  1551. It returns \f(CWDW_DLV_ERROR\fP on error.
  1552.  
  1553. .DS
  1554. \f(CWint dwarf_formflag(
  1555.     Dwarf_Attribute attr,
  1556.     Dwarf_Bool * return_bool,
  1557.     Dwarf_Error *error)\fP
  1558. .DE
  1559. When it succeeds,
  1560. \f(CWdwarf_formflag()\fP returns
  1561. \f(CWDW_DLV_OK\fP and sets \f(CW*return_bool\fP
  1562. \f(CW1\fP (i.e. true) (if the attribute has a non-zero value)
  1563. or \f(CW0\fP (i.e. false) (if the attribute has a zero value).
  1564. It returns \f(CWDW_DLV_ERROR\fP on error or if the \f(CWattr\fP
  1565. does not have form flag.
  1566.  
  1567. .DS
  1568. \f(CWint dwarf_formudata(
  1569.         Dwarf_Attribute   attr, 
  1570.     Dwarf_Unsigned  * return_uvalue,
  1571.         Dwarf_Error     * error)\fP
  1572. .DE
  1573. The function
  1574. \f(CWdwarf_formudata()\fP returns 
  1575. \f(CWDW_DLV_OK\fP and sets \f(CW*return_uvalue\fP
  1576. to
  1577. the \f(CWDwarf_Unsigned\fP 
  1578. value of the attribute represented by the descriptor \f(CWattr\fP if the
  1579. form of the attribute belongs to the \f(CWCONSTANT\fP class.  
  1580. It is an 
  1581. error for the form to not belong to this class.  
  1582. It returns \f(CWDW_DLV_ERROR\fP on error.
  1583.  
  1584. .DS
  1585. \f(CWint dwarf_formsdata(
  1586.         Dwarf_Attribute attr, 
  1587.     Dwarf_Signed  * return_svalue,
  1588.         Dwarf_Error *error)\fP
  1589. .DE
  1590. The function \f(CWdwarf_formsdata()\fP returns 
  1591. \f(CWDW_DLV_OK\fP and sets \f(CW*return_svalue\fP
  1592. to
  1593. the \f(CWDwarf_Signed\fP 
  1594. value of the attribute represented by the descriptor \f(CWattr\fP if the
  1595. form of the attribute belongs to the \f(CWCONSTANT\fP class.  
  1596. It is an 
  1597. error for the form to not belong to this class.  
  1598. If the size of the data 
  1599. attribute referenced is smaller than the size of the \f(CWDwarf_Signed\fP
  1600. type, its value is sign extended.  
  1601. It returns \f(CWDW_DLV_ERROR\fP on error.
  1602.  
  1603. .DS
  1604. \f(CWint dwarf_formblock(
  1605.         Dwarf_Attribute attr, 
  1606.     Dwarf_Block  ** return_block,
  1607.         Dwarf_Error *   error)\fP
  1608. .DE
  1609. The function \f(CWdwarf_formblock()\fP returns 
  1610. \f(CWDW_DLV_OK\fP and sets \f(CW*return_block\fP
  1611. to
  1612. a pointer to a 
  1613. \f(CWDwarf_Block\fP structure containing the value of the attribute 
  1614. represented by the descriptor \f(CWattr\fP if the form of the 
  1615. attribute belongs to the \f(CWBLOCK\fP class.  
  1616. It is an error
  1617. for the form to not belong to this class.  
  1618. The storage pointed 
  1619. to by a successful return of \f(CWdwarf_formblock()\fP should 
  1620. be free'd using the allocation type \f(CWDW_DLA_BLOCK\fP,  when 
  1621. no longer of interest (see \f(CWdwarf_dealloc()\fP).  
  1622. It returns
  1623. \f(CWDW_DLV_ERROR\fP on error.
  1624.  
  1625. .DS
  1626. \f(CWint dwarf_formstring(
  1627.         Dwarf_Attribute attr, 
  1628.     char        **  return_string,
  1629.         Dwarf_Error *error)\fP
  1630. .DE
  1631. The function \f(CWdwarf_formstring()\fP returns 
  1632. \f(CWDW_DLV_OK\fP and sets \f(CW*return_string\fP
  1633. to
  1634. a pointer to a 
  1635. null-terminated string containing  the value of the attribute 
  1636. represented by the descriptor \f(CWattr\fP if the form of the
  1637. attribute belongs to the \f(CWSTRING\fP class.  
  1638. It is an error
  1639. for the form to not belong to this class.  
  1640. The storage pointed 
  1641. to by a successful return of \f(CWdwarf_formstring()\fP should 
  1642. be free'd using the allocation type \f(CWDW_DLA_STRING\fP when 
  1643. no longer of interest (see \f(CWdwarf_dealloc()\fP).  
  1644. It returns \f(CWDW_DLV_ERROR\fP on error.
  1645.  
  1646. .DS
  1647. \f(CWint dwarf_loclist(
  1648.         Dwarf_Attribute attr, 
  1649.         Dwarf_Locdesc **llbuf,
  1650.         Dwarf_Signed  *listlen,
  1651.         Dwarf_Error *error)\fP
  1652. .DE
  1653. The function \f(CWdwarf_loclist()\fP sets \f(CW*llbuf\fP to point to 
  1654. an array of \f(CWDwarf_Locdesc\fP pointers corresponding to each of
  1655. the location expressions in a location list, and sets
  1656. \f(CW*listlen\fP to the number 
  1657. of elements in the array and returns \f(CWDW_DLV_OK\fP if the attribute is
  1658. appropriate.
  1659. It returns \f(CWDW_DLV_ERROR\fP on error. 
  1660. \f(CWdwarf_loclist()\fP works on \f(CWDW_AT_location\fP, 
  1661. \f(CWDW_AT_data_member_location\fP, \f(CWDW_AT_vtable_elem_location\fP,
  1662. \f(CWDW_AT_string_length\fP, \f(CWDW_AT_use_location\fP, and 
  1663. \f(CWDW_AT_return_addr\fP attributes.  
  1664.  
  1665. Storage allocated by a successful call of \f(CWdwarf_loclist()\fP should 
  1666. be deallocated when no longer of interest (see \f(CWdwarf_dealloc()\fP).
  1667. The block of \f(CWDwarf_Loc\fP structs pointed to by the \f(CWld_s\fP 
  1668. field of each \f(CWDwarf_Locdesc\fP structure 
  1669. should be deallocated with the allocation type \f(CWDW_DLA_LOC_BLOCK\fP. 
  1670. This should be followed by deallocation of the \f(CWllbuf\fP
  1671. using the allocation type \f(CWDW_DLA_LOCDESC\fP.
  1672. .in +2
  1673. .DS
  1674. \f(CWDwarf_Signed lcnt;
  1675. Dwarf_Locdesc *llbuf;
  1676. int lres;
  1677.  
  1678. if ((lres = dwarf_loclist(someattr, &llbuf,&lcnt &error)) == DW_DLV_OK) {
  1679.         for (i = 0; i < lcnt; ++i) {
  1680.             /* use llbuf[i] */
  1681.  
  1682.             /* Deallocate Dwarf_Loc block of llbuf[i] */
  1683.             dwarf_dealloc(dbg, llbuf[i].ld_s, DW_DLA_LOC_BLOCK);
  1684.  
  1685.         }
  1686.         dwarf_dealloc(dbg, llbuf, DW_DLA_LOCDESC);
  1687. }\fP
  1688. .DE
  1689. .in -2
  1690. .P
  1691.  
  1692. .P
  1693. .H 2 "Line Number Operations"
  1694. These functions are concerned with accessing line number entries,
  1695. mapping debugging information entry objects to their corresponding
  1696. source lines, and providing a mechanism for obtaining information
  1697. about line number entries.  Although, the interface talks of "lines"
  1698. what is really meant is "statements".  In case there is more than
  1699. one statement on the same line, there will be at least one descriptor
  1700. per statement, all with the same line number.  If column number is
  1701. also being represented they will have the column numbers of the start
  1702. of the statements also represented.
  1703. .P
  1704. There can also be more than one Dwarf_Line per statement.
  1705. For example, if a file is preprocessed by a language translator,
  1706. this could result in translator output showing 2 or more sets of line
  1707. numbers per translated line of output.
  1708.  
  1709. .H 3 "Get A Set of Lines"
  1710. The function returns information about every source line for a 
  1711. particular compilation-unit.  The compilation-unit is specified
  1712. by the corresponding die.
  1713.  
  1714. .DS
  1715. \f(CWint dwarf_srclines(
  1716.         Dwarf_Die die, 
  1717.         Dwarf_Line **linebuf, 
  1718.     Dwarf_Signed *linecount,
  1719.         Dwarf_Error *error)\fP
  1720. .DE
  1721. The function \f(CWdwarf_srclines()\fP places all line number descriptors 
  1722. for a single compilation unit into a single block, sets \f(CW*linebuf\fP 
  1723. to point to that block, 
  1724. sets \f(CW*linecount\fP to the number of descriptors in this block
  1725. and returns \f(CWDW_DLV_OK\fP.
  1726. The compilation-unit is indicated by the given \f(CWdie\fP which must be
  1727. a compilation-unit die.  
  1728. It returns \f(CWDW_DLV_ERROR\fP on error.  
  1729. On
  1730. successful return, each line number information structure pointed to by 
  1731. an entry in the block should be free'd using \f(CWdwarf_dealloc()\fP with 
  1732. the allocation type \f(CWDW_DLA_LINE\fP when no longer of interest.  Also 
  1733. the block of descriptors itself should be free'd using \f(CWdwarf_dealloc()\fP
  1734. with the allocation type \f(CWDW_DLA_LIST\fP when no longer of interest.
  1735. .P
  1736. .in +2
  1737. .DS
  1738. \f(CWDwarf_Signed cnt;
  1739. Dwarf_Line *linebuf;
  1740. int sres;
  1741.  
  1742. if ((sres = dwarf_srclines(somedie, &linebuf,&cnt, &error)) == DW_DLV_OK) {
  1743.  
  1744.         for (i = 0; i < cnt; ++i) {
  1745.                 /* use linebuf[i] */
  1746.                 dwarf_dealloc(dbg, linebuf[i], DW_DLA_LINE);
  1747.         }
  1748.         dwarf_dealloc(dbg, linebuf, DW_DLA_LIST);
  1749. }\fP
  1750. .DE
  1751. .in -2
  1752.  
  1753. .H 3 "Get the set of Source File Names"
  1754.  
  1755. The function returns the names of the source files that have contributed
  1756. to the compilation-unit represented by the given DIE.  Only the source
  1757. files named in the statement program prologue are returned.
  1758.  
  1759. .DS
  1760. \f(CWint dwarf_srcfiles(
  1761.         Dwarf_Die die,
  1762.         char ***srcfiles,
  1763.         Dwarf_Signed *srccount,
  1764.         Dwarf_Error *error)\fP
  1765. .DE
  1766. When it succeeds
  1767. \f(CWdwarf_srcfiles()\fP returns 
  1768. \f(CWDW_DLV_OK\fP
  1769. and
  1770. puts
  1771. the number of source
  1772. files named in the statement program prologue indicated by the given
  1773. \f(CWdie\fP
  1774. into \f(CW*srccount\fP.  
  1775. Source files defined in the statement program are ignored.
  1776. The given \f(CWdie\fP should have the tag \f(CWDW_TAG_compile_unit\fP.
  1777. The location pointed to by \f(CWsrcfiles\fP is set to point to a list
  1778. of pointers to null-terminated strings that name the source
  1779. files.  
  1780. On a successful return from this function, each of the
  1781. strings returned should be individually free'd using \f(CWdwarf_dealloc()\fP
  1782. with the allocation type \f(CWDW_DLA_STRING\fP when no longer of
  1783. interest.  
  1784. This should be followed by free-ing the list using
  1785. \f(CWdwarf_dealloc()\fP with the allocation type \f(CWDW_DLA_LIST\fP.
  1786. It returns \f(CWDW_DLV_ERROR\fP on error. 
  1787. It returns \f(CWDW_DLV_NO_ENTRY\fP
  1788. if there is no
  1789. corresponding statement program (i.e., if there is no line information).
  1790. .in +2
  1791. .DS
  1792. \f(CWDwarf_Signed cnt;
  1793. char **srcfiles;
  1794. int res;
  1795.  
  1796. if ((res = dwarf_srcfiles(somedie, &srcfiles,&cnt &error)) == DW_DLV_OK) {
  1797.  
  1798.         for (i = 0; i < cnt; ++i) {
  1799.                 /* use srcfiles[i] */
  1800.                 dwarf_dealloc(dbg, srcfiles[i], DW_DLA_STRING);
  1801.         }
  1802.         dwarf_dealloc(dbg, srcfiles, DW_DLA_LIST);
  1803. }\fP
  1804. .DE
  1805. .in -2
  1806. .H 3 "Get information about a Single Table Line"
  1807. The following functions can be used on the \f(CWDwarf_Line\fP descriptors
  1808. returned by \f(CWdwarf_srclines()\fP to obtain information about the
  1809. source lines.
  1810.  
  1811. .DS
  1812. \f(CWint dwarf_linebeginstatement(
  1813.         Dwarf_Line line, 
  1814.     Dwarf_Bool *return_bool,
  1815.         Dwarf_Error *error)\fP
  1816. .DE
  1817. The function \f(CWdwarf_linebeginstatement()\fP returns 
  1818. \f(CWDW_DLV_OK\fP and sets \f(CW*return_bool\fP
  1819. to
  1820. \fInon-zero\fP 
  1821. (if \f(CWline\fP represents a line number entry that is marked as
  1822. beginning a statement).  
  1823. or
  1824. \fIzero\fP ((if \f(CWline\fP represents a line number entry
  1825. that is not marked as beginning a statement).
  1826. It returns \f(CWDW_DLV_ERROR\fP on error.
  1827. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  1828.  
  1829. .P
  1830. .DS
  1831. \f(CWint dwarf_lineendsequence(
  1832.     Dwarf_Line line,
  1833.     Dwarf_Bool *return_bool,
  1834.     Dwarf_Error *error)\fP
  1835. .DE
  1836. The function \f(CWdwarf_lineendsequence()\fP returns
  1837. \f(CWDW_DLV_OK\fP and sets \f(CW*return_bool\fP
  1838. \fInon-zero\fP
  1839. if \f(CWline\fP represents a line number entry that is marked as
  1840. ending a text sequence)
  1841. or
  1842. \fIzero\fP ((if \f(CWline\fP represents a line number entry
  1843. that is not marked as ending a text sequence).
  1844. It returns \f(CWDW_DLV_ERROR\fP on error.
  1845. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  1846.  
  1847. .P
  1848. .DS
  1849. \f(CWint dwarf_lineno(
  1850.         Dwarf_Line       line, 
  1851.     Dwarf_Unsigned * returned_lineno,
  1852.         Dwarf_Error    * error)\fP
  1853. .DE
  1854. The function \f(CWdwarf_lineno()\fP returns 
  1855. \f(CWDW_DLV_OK\fP and sets \f(CW*return_lineno\fP to
  1856. the source statement line 
  1857. number corresponding to the descriptor \f(CWline\fP.  
  1858. It returns \f(CWDW_DLV_ERROR\fP on error.
  1859. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  1860.  
  1861. .P
  1862. .DS
  1863. \f(CWint dwarf_lineaddr(
  1864.         Dwarf_Line   line, 
  1865.     Dwarf_Addr  *return_lineaddr,
  1866.         Dwarf_Error *error)\fP
  1867. .DE
  1868. The function \f(CWdwarf_lineaddr()\fP returns 
  1869. \f(CWDW_DLV_OK\fP and sets \f(CW*return_lineaddr\fP to
  1870. the address associated 
  1871. with the descriptor \f(CWline\fP.  
  1872. It returns \f(CWDW_DLV_ERROR\fP  on error.
  1873. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  1874.  
  1875. .P
  1876. .DS
  1877. \f(CWint dwarf_lineoff(
  1878.         Dwarf_Line line, 
  1879.     Dwarf_Signed   * return_lineoff,
  1880.         Dwarf_Error *error)\fP
  1881. .DE
  1882. The function \f(CWdwarf_lineoff()\fP returns 
  1883. \f(CWDW_DLV_OK\fP and sets \f(CW*return_lineoff\fP to
  1884. the column number at which
  1885. the statement represented by \f(CWline\fP begins.  
  1886. It sets \f(CWreturn_lineoff\fP to \fI-1\fP 
  1887. if the column number of the statement is not represented.  
  1888. On error it returns \f(CWDW_DLV_ERROR\fP.
  1889. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  1890.  
  1891. .DS
  1892. \f(CWint dwarf_linesrc(
  1893.         Dwarf_Line line, 
  1894.     char  **   return_linesrc,
  1895.         Dwarf_Error *error)\fP
  1896. .DE
  1897. The function \f(CWdwarf_linesrc()\fP returns
  1898. \f(CWDW_DLV_OK\fP and sets \f(CW*return_linesrc\fP to
  1899. a pointer to a
  1900. null-terminated string of characters that represents the name of the 
  1901. source-file where \f(CWline\fP occurs.  
  1902. It returns \f(CWDW_DLV_ERROR\fP on 
  1903. error.  
  1904. .P
  1905. If the applicable file name in the line table Statement Program Prolog 
  1906. does not start with a '/' character
  1907. the string in \f(CWDW_AT_comp_dir\fP (if applicable and present)
  1908. or the applicable
  1909. directory name from the line Statement Program Prolog 
  1910. is prepended to the
  1911. file name in the line table Statement Program Prolog
  1912. to make a full path.
  1913. .P
  1914. The storage pointed to by a successful return of 
  1915. \f(CWdwarf_linesrc()\fP should be free'd using \f(CWdwarf_dealloc()\fP with
  1916. the allocation type \f(CWDW_DLA_STRING\fP when no longer of interest.
  1917. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  1918.  
  1919. .DS
  1920. \f(CWint dwarf_lineblock(
  1921.         Dwarf_Line line, 
  1922.     Dwarf_Bool *return_bool,
  1923.         Dwarf_Error *error)\fP
  1924. .DE
  1925. The function
  1926. \f(CWdwarf_lineblock()\fP returns 
  1927. \f(CWDW_DLV_OK\fP and sets \f(CW*return_linesrc\fP to
  1928. non-zero (i.e. true)(if the line is marked as 
  1929. beginning a basic block)
  1930. or zero (i.e. false) (if the line is marked as not
  1931. beginning a basic block).  
  1932. It returns \f(CWDW_DLV_ERROR\fP on error.
  1933. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  1934.  
  1935. .\"#if 0
  1936. .\".H 3 "Finding a Line Given A PC value"
  1937. .\"This is a 'higher level' (High-level) interface to line information.
  1938. .\"
  1939. .\".DS
  1940. .\"\f(CWint dwarf_pclines(
  1941. .\"        Dwarf_Debug dbg,
  1942. .\"        Dwarf_Addr pc,
  1943. .\"        Dwarf_Line **linebuf,
  1944. .\"        Dwarf_Signed slide,
  1945. .\"        Dwarf_Signed *linecount,
  1946. .\"        Dwarf_Error *error)\fP
  1947. .\".DE
  1948. .\"The function \f(CWdwarf_pclines()\fP places all line number descriptors 
  1949. .\"that correspond to the value of \f(CWpc\fP into a single block and sets 
  1950. .\"\f(CWlinebuf\fP to point to that block.  A count of the number of 
  1951. .\"\f(CWDwarf_Line\fP descriptors that are in this block is returned.  For 
  1952. .\"most cases, the count returned will be \fIone\fP, though it may be higher 
  1953. .\"if optimizations such as common subexpression elimination result in multiple 
  1954. .\"line number entries for a given value of \f(CWpc\fP.  The \f(CWslide\fP 
  1955. .\"argument specifies the direction to search for the nearest line number 
  1956. .\"entry in the event that there is no line number entry that contains an 
  1957. .\"exact match for \f(CWpc\fP.  This argument may be one of: 
  1958. .\"\f(CWDLS_BACKWARD\fP, \f(CWDLS_NOSLIDE\fP, \f(CWDLS_FORWARD\fP.
  1959. .\"\f(CWDW_DLV_NOCOUNT\fP is returned on error.  On successful return, each 
  1960. .\"line information structure pointed to by an entry in the block should be 
  1961. .\"free'd using \f(CWdwarf_dealloc()\fP with the allocation type 
  1962. .\"\f(CWDW_DLA_LINE\fP when no longer of interest.  The block itself should 
  1963. .\"be free'd using \f(CWdwarf_dealloc()\fP with the allocation type 
  1964. .\"\f(CWDW_DLA_LIST\fP when no longer of interest.
  1965. .\"#endif
  1966.  
  1967. .H 2 "Global Name Space Operations" 
  1968. These operations operate on the .debug_pubnames section of the debugging 
  1969. information.
  1970.  
  1971. .H 3 "Debugger Interface Operations"
  1972.  
  1973. .DS
  1974. \f(CWint dwarf_get_globals(
  1975.         Dwarf_Debug dbg,
  1976.         Dwarf_Global **globals,
  1977.         Dwarf_Signed * return_count,
  1978.         Dwarf_Error *error)\fP
  1979. .DE
  1980. The function \f(CWdwarf_get_globals()\fP returns 
  1981. \f(CWDW_DLV_OK\fP and sets \f(CW*return_count\fP to
  1982. the count of pubnames
  1983. represented in the section containing pubnames i.e. .debug_pubnames.  
  1984. It also stores at \f(CW*globals\fP, a pointer 
  1985. to a list of \f(CWDwarf_Global\fP descriptors, one for each of the 
  1986. pubnames in the .debug_pubnames section.  
  1987. It returns \f(CWDW_DLV_ERROR\fP on error. 
  1988. It returns \f(CWDW_DLV_NO_ENTRY\fP if the .debug_pubnames 
  1989. section does not exist.
  1990.  
  1991. On a successful return from 
  1992. this function, the \f(CWDwarf_Global\fP descriptors should be individually 
  1993. free'd using \f(CWdwarf_dealloc()\fP with the allocation type 
  1994. \f(CWDW_DLA_GLOBAL\fP, followed by the deallocation of the list itself 
  1995. with the allocation type \f(CWDW_DLA_LIST\fP when the descriptors are 
  1996. no longer of interest.
  1997.  
  1998. .in +2
  1999. .DS
  2000. \f(CWDwarf_Signed cnt;
  2001. Dwarf_Global *globs;
  2002. int res;
  2003.  
  2004. if ((res = dwarf_get_globals(dbg, &globs,&cnt, &error)) == DW_DLV_OK) {
  2005.  
  2006.         for (i = 0; i < cnt; ++i) {
  2007.                 /* use globs[i] */
  2008.                 dwarf_dealloc(dbg, globs[i], DW_DLA_GLOBAL);
  2009.         }
  2010.         dwarf_dealloc(dbg, globs, DW_DLA_LIST);
  2011. }\fP
  2012. .DE
  2013. .in -2
  2014.  
  2015. .DS
  2016. \f(CWint dwarf_globname(
  2017.         Dwarf_Global global,
  2018.         char **      return_name,
  2019.         Dwarf_Error *error)\fP
  2020. .DE
  2021. The function \f(CWdwarf_globname()\fP returns
  2022. \f(CWDW_DLV_OK\fP and sets \f(CW*return_name\fP to
  2023. a pointer to a 
  2024. null-terminated string that names the pubname represented by the 
  2025. \f(CWDwarf_Global\fP descriptor, \f(CWglobal\fP.  
  2026. It returns \f(CWDW_DLV_ERROR\fP on error.  
  2027. On a successful return from this function, the string should
  2028. be free'd using \f(CWdwarf_dealloc()\fP, with the allocation type
  2029. \f(CWDW_DLA_STRING\fP when no longer of interest.
  2030. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2031.  
  2032. .DS
  2033. \f(CWint dwarf_global_die_offset(
  2034.         Dwarf_Global global,
  2035.     Dwarf_Off   *return_offset,
  2036.         Dwarf_Error *error)\fP
  2037. .DE
  2038. The function \f(CWdwarf_global_die_offset()\fP returns
  2039. \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to
  2040. the offset in
  2041. the section containing DIE's, i.e. .debug_info, of the DIE representing
  2042. the pubname that is described by the \f(CWDwarf_Global\fP descriptor, 
  2043. \f(CWglob\fP.  
  2044. It returns \f(CWDW_DLV_ERROR\fP on error.
  2045. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2046.  
  2047. .DS
  2048. \f(CWint dwarf_global_cu_offset(
  2049.         Dwarf_Global global,
  2050.     Dwarf_Off   *return_offset,
  2051.         Dwarf_Error *error)\fP
  2052. .DE
  2053. The function \f(CWdwarf_global_cu_offset()\fP returns 
  2054. \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to
  2055. the offset in
  2056. the section containing DIE's, i.e. .debug_info, of the compilation-unit
  2057. header of the compilation-unit that contains the pubname described 
  2058. by the \f(CWDwarf_Global\fP descriptor, \f(CWglobal\fP.  
  2059. It returns \f(CWDW_DLV_ERROR\fP on error.
  2060. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2061.  
  2062. .DS
  2063. \f(CWint dwarf_global_name_offsets(
  2064.         Dwarf_Global global,
  2065.         char     **return_name,
  2066.         Dwarf_Off *die_offset,
  2067.         Dwarf_Off *cu_offset,
  2068.         Dwarf_Error *error)\fP
  2069. .DE
  2070. The function \f(CWdwarf_global_name_offsets()\fP returns
  2071. \f(CWDW_DLV_OK\fP and sets \f(CW*return_name\fP to
  2072. a pointer to
  2073. a null-terminated string that gives the name of the pubname
  2074. described by the \f(CWDwarf_Global\fP descriptor \f(CWglobal\fP.  
  2075. It returns \f(CWDW_DLV_ERROR\fP on error.  
  2076. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2077. It also returns in the locations 
  2078. pointed to by \f(CWdie_offset\fP, and \f(CWcu_offset\fP, the offsets
  2079. of the DIE representing the pubname, and the compilation-unit header 
  2080. of the compilation-unit containing the pubname, respectively.  
  2081. On a 
  2082. successful return from \f(CWdwarf_global_name_offsets()\fP the storage 
  2083. pointed to by \f(CWreturn_name\fP 
  2084. should be free'd using \f(CWdwarf_dealloc()\fP, 
  2085. with the allocation type \f(CWDW_DLA_STRING\fP when no longer of interest.
  2086.  
  2087. .H 2 "Weak Name Space Operations" 
  2088. These operations operate on the .debug_weaknames section of the debugging 
  2089. information.
  2090. .P
  2091. These operations are SGI specific, not part of standard DWARF.
  2092. .P
  2093.  
  2094. .H 3 "Debugger Interface Operations"
  2095.  
  2096. .DS
  2097. \f(CWint dwarf_get_weaks(
  2098.         Dwarf_Debug dbg,
  2099.         Dwarf_Weak **weaks,
  2100.     Dwarf_Signed *weak_count,
  2101.         Dwarf_Error *error)\fP
  2102. .DE
  2103. The function \f(CWdwarf_get_weaks()\fP returns
  2104. \f(CWDW_DLV_OK\fP and sets \f(CW*weak_count\fP to
  2105. the count of weak names
  2106. represented in the section containing weak names i.e. .debug_weaknames.  
  2107. It returns \f(CWDW_DLV_ERROR\fP on error. 
  2108. It returns \f(CWDW_DLV_NO_ENTRY\fP if the section does not exist.  
  2109. It also stores in \f(CW*weaks\fP, a pointer to 
  2110. a list of \f(CWDwarf_Weak\fP descriptors, one for each of the weak names 
  2111. in the .debug_weaknames section.  
  2112. On a successful return from this function, 
  2113. the \f(CWDwarf_Weak\fP descriptors should be individually free'd using 
  2114. \f(CWdwarf_dealloc()\fP with the allocation type \f(CWDW_DLA_WEAK\fP, 
  2115. followed by the deallocation of the list itself with the allocation type 
  2116. \f(CWDW_DLA_LIST\fP when the descriptors are no longer of interest.
  2117.  
  2118. .in +2
  2119. .DS
  2120. \f(CWDwarf_Signed cnt;
  2121. Dwarf_Weak *weaks;
  2122. int res;
  2123.  
  2124. if ((res = dwarf_get_weaks(dbg, &weaks,&cnt, &error)) == DW_DLV_OK) {
  2125.  
  2126.         for (i = 0; i < cnt; ++i) {
  2127.                 /* use weaks[i] */
  2128.                 dwarf_dealloc(dbg, weaks[i], DW_DLA_WEAK);
  2129.         }
  2130.         dwarf_dealloc(dbg, weaks, DW_DLA_LIST);
  2131. }\fP
  2132. .DE
  2133. .in -2
  2134.  
  2135. .DS
  2136. \f(CWint dwarf_weakname(
  2137.         Dwarf_Weak weak,
  2138.     char    ** return_name,
  2139.         Dwarf_Error *error)\fP
  2140. .DE
  2141. The function \f(CWdwarf_weakname()\fP returns
  2142. \f(CWDW_DLV_OK\fP and sets \f(CW*return_name\fP to
  2143. a pointer to a null-terminated
  2144. string that names the weak name represented by the 
  2145. \f(CWDwarf_Weak\fP descriptor, \f(CWweak\fP.  
  2146. It returns \f(CWDW_DLV_ERROR\fP on error.  
  2147. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2148. On a successful return from this function, the string should
  2149. be free'd using \f(CWdwarf_dealloc()\fP, with the allocation type
  2150. \f(CWDW_DLA_STRING\fP when no longer of interest.
  2151.  
  2152. .DS
  2153. \f(CWint dwarf_weak_die_offset(
  2154.         Dwarf_Weak weak,
  2155.     Dwarf_Off  *return_offset,
  2156.         Dwarf_Error *error)\fP
  2157. .DE
  2158. The function \f(CWdwarf_weak_die_offset()\fP returns
  2159. \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to the offset in
  2160. the section containing DIE's, i.e. .debug_info, of the DIE representing
  2161. the weak name that is described by the \f(CWDwarf_Weak\fP descriptor, 
  2162. \f(CWweak\fP.  
  2163. It returns \f(CWDW_DLV_ERROR\fP on error.
  2164. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2165.  
  2166. .DS
  2167. \f(CWint dwarf_weak_cu_offset(
  2168.         Dwarf_Weak weak,
  2169.     Dwarf_Off  *return_offset,
  2170.         Dwarf_Error *error)\fP
  2171. .DE
  2172. The function \f(CWdwarf_weak_cu_offset()\fP returns
  2173. \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to the offset in
  2174. the section containing DIE's, i.e. .debug_info, of the compilation-unit
  2175. header of the compilation-unit that contains the weak name described 
  2176. by the \f(CWDwarf_Weak\fP descriptor, \f(CWweak\fP.  
  2177. It returns \f(CWDW_DLV_ERROR\fP on error.
  2178. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2179.  
  2180. .DS
  2181. \f(CWint dwarf_weak_name_offsets(
  2182.         Dwarf_Weak weak,
  2183.     char **  weak_name,
  2184.         Dwarf_Off *die_offset,
  2185.         Dwarf_Off *cu_offset,
  2186.         Dwarf_Error *error)\fP
  2187. .DE
  2188. The function \f(CWdwarf_weak_name_offsets()\fP returns
  2189. \f(CWDW_DLV_OK\fP and sets \f(CW*weak_name\fP to
  2190. a pointer to
  2191. a null-terminated string that gives the name of the weak name
  2192. described by the \f(CWDwarf_Weak\fP descriptor \f(CWweak\fP.  
  2193. It also returns in the locations 
  2194. pointed to by \f(CWdie_offset\fP, and \f(CWcu_offset\fP, the offsets
  2195. of the DIE representing the weak name, and the compilation-unit header 
  2196. of the compilation-unit containing the weak name, respectively.  
  2197. It returns \f(CWDW_DLV_ERROR\fP on error.  
  2198. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2199. On a 
  2200. successful return from \f(CWdwarf_weak_name_offsets()\fP the storage 
  2201. pointed to by \f(CWweak_name\fP
  2202. should be free'd using \f(CWdwarf_dealloc()\fP, 
  2203. with the allocation type \f(CWDW_DLA_STRING\fP when no longer of interest.
  2204.  
  2205. .H 2 "Static Function Names Operations"
  2206. This section is SGI specific and is not part of standard DWARF version 2.
  2207. .P
  2208. These function operate on the .debug_funcnames section of the debugging
  2209. information.  The .debug_funcnames section contains the names of static
  2210. functions defined in the object, the offsets of the \f(CWDIE\fPs that
  2211. represent the definitions of the corresponding functions, and the offsets
  2212. of the start of the compilation-units that contain the definitions of
  2213. those functions.
  2214.  
  2215. .H 3 "Debugger Interface Operations"
  2216.  
  2217. .DS
  2218. \f(CWint dwarf_get_funcs(
  2219.         Dwarf_Debug dbg,
  2220.         Dwarf_Func **funcs,
  2221.         Dwarf_Signed *func_count,
  2222.         Dwarf_Error *error)\fP
  2223. .DE
  2224. The function \f(CWdwarf_get_funcs()\fP returns
  2225. \f(CWDW_DLV_OK\fP and sets \f(CW*func_count\fP to
  2226. the count of static
  2227. function names represented in the section containing static function
  2228. names, i.e. .debug_funcnames.  
  2229. It also 
  2230. stores, at \f(CW*funcs\fP, a pointer to a list of \f(CWDwarf_Func\fP 
  2231. descriptors, one for each of the static functions in the .debug_funcnames 
  2232. section.  
  2233. It returns \f(CWDW_DLV_NOCOUNT\fP on error.
  2234. It returns \f(CWDW_DLV_NO_ENTRY\fP
  2235. if the .debug_funcnames section does not exist.  
  2236. On a successful return from this function, the \f(CWDwarf_Func\fP 
  2237. descriptors should be individually free'd using \f(CWdwarf_dealloc()\fP 
  2238. with the allocation type \f(CWDW_DLA_FUNC\fP, followed by the deallocation 
  2239. of the list itself with the allocation type \f(CWDW_DLA_LIST\fP when 
  2240. the descriptors are no longer of interest.
  2241.  
  2242. .in +2
  2243. .DS
  2244. \f(CWDwarf_Signed cnt;
  2245. Dwarf_Func *funcs;
  2246. int fres;
  2247.  
  2248. if ((fres = dwarf_get_funcs(dbg, &funcs, &error)) == DW_DLV_OK) {
  2249.  
  2250.         for (i = 0; i < cnt; ++i) {
  2251.                 /* use funcs[i] */
  2252.                 dwarf_dealloc(dbg, funcs[i], DW_DLA_FUNC);
  2253.         }
  2254.         dwarf_dealloc(dbg, funcs, DW_DLA_LIST);
  2255. }\fP
  2256. .DE
  2257. .in -2
  2258.  
  2259. .DS
  2260. \f(CWint dwarf_funcname(
  2261.         Dwarf_Func func,
  2262.         char **    return_name,
  2263.         Dwarf_Error *error)\fP
  2264. .DE
  2265. The function \f(CWdwarf_funcname()\fP returns
  2266. \f(CWDW_DLV_OK\fP and sets \f(CW*return_name\fP to
  2267. a pointer to a
  2268. null-terminated string that names the static function represented by the
  2269. \f(CWDwarf_Func\fP descriptor, \f(CWfunc\fP.  
  2270. It returns \f(CWDW_DLV_ERROR\fP on error.  
  2271. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2272. On a successful return from this function, the string should
  2273. be free'd using \f(CWdwarf_dealloc()\fP, with the allocation type
  2274. \f(CWDW_DLA_STRING\fP when no longer of interest.
  2275.  
  2276. .DS
  2277. \f(CWint dwarf_func_die_offset(
  2278.         Dwarf_Func func,
  2279.     Dwarf_Off  *return_offset,
  2280.         Dwarf_Error *error)\fP
  2281. .DE
  2282. The function \f(CWdwarf_func_die_offset()\fP, returns
  2283. \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to
  2284. the offset in
  2285. the section containing DIE's, i.e. .debug_info, of the DIE representing
  2286. the static function that is described by the \f(CWDwarf_Func\fP 
  2287. descriptor, \f(CWfunc\fP.  
  2288. It returns \f(CWDW_DLV_ERROR\fP on error.
  2289. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2290.  
  2291. .DS
  2292. \f(CWint dwarf_func_cu_offset(
  2293.         Dwarf_Func func,
  2294.     Dwarf_Off  *return_offset,
  2295.         Dwarf_Error *error)\fP
  2296. .DE
  2297. The function \f(CWdwarf_func_cu_offset()\fP returns
  2298. \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to
  2299. the offset in
  2300. the section containing DIE's, i.e. .debug_info, of the compilation-unit
  2301. header of the compilation-unit that contains the static function
  2302. described by the \f(CWDwarf_Func\fP descriptor, \f(CWfunc\fP.  
  2303. It returns \f(CWDW_DLV_ERROR\fP on error.
  2304. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2305.  
  2306. .DS
  2307. \f(CWint dwarf_func_name_offsets(
  2308.         Dwarf_Func func,
  2309.     char     **func_name,
  2310.         Dwarf_Off *die_offset,
  2311.         Dwarf_Off *cu_offset,
  2312.         Dwarf_Error *error)\fP
  2313. .DE
  2314. The function \f(CWdwarf_func_name_offsets()\fP returns
  2315. \f(CWDW_DLV_OK\fP and sets \f(CW*func_name\fP to
  2316. a pointer to
  2317. a null-terminated string that gives the name of the static
  2318. function described by the \f(CWDwarf_Func\fP descriptor \f(CWfunc\fP.
  2319. It also returns in the locations
  2320. pointed to by \f(CWdie_offset\fP, and \f(CWcu_offset\fP, the offsets
  2321. of the DIE representing the static function, and the compilation-unit 
  2322. header of the compilation-unit containing the static function,
  2323. respectively.  
  2324. It returns \f(CWDW_DLV_ERROR\fP on error.  
  2325. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2326. On a successful return from \f(CWdwarf_func_name_offsets()\fP
  2327. the storage pointed to by  \f(CWfunc_name\fP should be free'd using
  2328. \f(CWdwarf_dealloc()\fP, with the allocation type \f(CWDW_DLA_STRING\fP
  2329. when no longer of interest.
  2330.  
  2331. .H 2 "User Defined Type Names Operations"
  2332. This section is SGI specific and is not part of standard DWARF version 2.
  2333. .P
  2334. These functions operate on the .debug_typenames section of the debugging
  2335. information.  The .debug_typenames section contains the names of file-scope
  2336. user-defined types, the offsets of the \f(CWDIE\fPs that represent the
  2337. definitions of those types, and the offsets of the compilation-units 
  2338. that contain the definitions of those types.
  2339.  
  2340. .H 3 "Debugger Interface Operations"
  2341.  
  2342. .DS
  2343. \f(CWint dwarf_get_types(
  2344.         Dwarf_Debug dbg,
  2345.         Dwarf_Type **types,
  2346.         Dwarf_Signed *typecount,
  2347.         Dwarf_Error *error)\fP
  2348. .DE
  2349. The function \f(CWdwarf_get_types()\fP returns
  2350. \f(CWDW_DLV_OK\fP and sets \f(CW*typecount\fP to
  2351. the count of user-defined
  2352. type names represented in the section containing user-defined type names,
  2353. i.e. .debug_typenames.  
  2354. It also stores at \f(CW*types\fP, 
  2355. a pointer to a list of \f(CWDwarf_Type\fP descriptors, one for each of the 
  2356. user-defined type names in the .debug_typenames section.  
  2357. It returns \f(CWDW_DLV_NOCOUNT\fP on error. 
  2358. It returns \f(CWDW_DLV_NO_ENTRY\fP if 
  2359. the .debug_typenames section does not exist.  
  2360. On a successful 
  2361. return from this function, the \f(CWDwarf_Type\fP descriptors should be 
  2362. individually free'd using \f(CWdwarf_dealloc()\fP with the allocation type 
  2363. \f(CWDW_DLA_TYPENAME\fP, followed by the deallocation of the list itself 
  2364. with the allocation type \f(CWDW_DLA_LIST\fP when the descriptors are no 
  2365. longer of interest.
  2366.  
  2367. .in +2
  2368. .DS
  2369. \f(CWDwarf_Signed cnt;
  2370. Dwarf_Type *types;
  2371. int res;
  2372.  
  2373. if ((res = dwarf_get_types(dbg, &types,&cnt, &error)) == DW_DLV_OK) {
  2374.  
  2375.         for (i = 0; i < cnt; ++i) {
  2376.                 /* use types[i] */
  2377.                 dwarf_dealloc(dbg, types[i], DW_DLA_TYPENAME);
  2378.         }
  2379.         dwarf_dealloc(dbg, types, DW_DLA_LIST);
  2380. }\fP
  2381. .DE
  2382. .in -2
  2383.  
  2384. .DS
  2385. \f(CWint dwarf_typename(
  2386.         Dwarf_Type   type,
  2387.         char       **return_name,
  2388.         Dwarf_Error *error)\fP
  2389. .DE
  2390. The function \f(CWdwarf_typename()\fP returns
  2391. \f(CWDW_DLV_OK\fP and sets \f(CW*return_name\fP to
  2392. a pointer to a
  2393. null-terminated string that names the user-defined type represented by the
  2394. \f(CWDwarf_Type\fP descriptor, \f(CWtype\fP.  
  2395. It returns \f(CWDW_DLV_ERROR\fP on error.  
  2396. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2397. On a successful return from this function, the string should
  2398. be free'd using \f(CWdwarf_dealloc()\fP, with the allocation type
  2399. \f(CWDW_DLA_STRING\fP when no longer of interest.
  2400.  
  2401. .DS
  2402. \f(CWint dwarf_type_die_offset(
  2403.         Dwarf_Type type,
  2404.         Dwarf_Off  *return_offset,
  2405.         Dwarf_Error *error)\fP
  2406. .DE
  2407. The function \f(CWdwarf_type_die_offset()\fP returns
  2408. \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to
  2409. the offset in
  2410. the section containing DIE's, i.e. .debug_info, of the DIE representing
  2411. the user-defined type that is described by the \f(CWDwarf_Type\fP 
  2412. descriptor, \f(CWtype\fP.  
  2413. It returns \f(CWDW_DLV_ERROR\fP on error.
  2414. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2415.  
  2416. .DS
  2417. \f(CWint dwarf_type_cu_offset(
  2418.         Dwarf_Type type,
  2419.         Dwarf_Off  *return_offset,
  2420.         Dwarf_Error *error)\fP
  2421. .DE
  2422. The function \f(CWdwarf_type_cu_offset()\fP returns
  2423. \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to
  2424. the offset in
  2425. the section containing DIE's, i.e. .debug_info, of the compilation-unit
  2426. header of the compilation-unit that contains the user-defined type
  2427. described by the \f(CWDwarf_Type\fP descriptor, \f(CWtype\fP.  
  2428. It returns \f(CWDW_DLV_ERROR\fP on error.
  2429. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2430.  
  2431. .DS
  2432. \f(CWint dwarf_type_name_offsets(
  2433.         Dwarf_Type   type,
  2434.         char      ** returned_name,
  2435.         Dwarf_Off *  die_offset,
  2436.         Dwarf_Off *  cu_offset,
  2437.         Dwarf_Error *error)\fP
  2438. .DE
  2439. The function \f(CWdwarf_type_name_offsets()\fP returns
  2440. \f(CWDW_DLV_OK\fP and sets \f(CW*returned_name\fP to
  2441. a pointer to
  2442. a null-terminated string that gives the name of the user-defined
  2443. type described by the \f(CWDwarf_Type\fP descriptor \f(CWtype\fP.
  2444. It also returns in the locations
  2445. pointed to by \f(CWdie_offset\fP, and \f(CWcu_offset\fP, the offsets
  2446. of the DIE representing the user-defined type, and the compilation-unit 
  2447. header of the compilation-unit containing the user-defined type,
  2448. respectively.  
  2449. It returns \f(CWDW_DLV_ERROR\fP on error.  
  2450. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2451. On a successful return from \f(CWdwarf_type_name_offsets()\fP
  2452. the storage pointed to by \f(CWreturned_name\fP should
  2453. be free'd using
  2454. \f(CWdwarf_dealloc()\fP, with the allocation type \f(CWDW_DLA_STRING\fP
  2455. when no longer of interest.
  2456.  
  2457. .H 2 "User Defined Static Variable Names Operations"
  2458. This section is SGI specific and is not part of standard DWARF version 2.
  2459. .P
  2460. These functions operate on the .debug_varnames section of the debugging
  2461. information.  The .debug_varnames section contains the names of file-scope
  2462. static variables, the offsets of the \f(CWDIE\fPs that represent the 
  2463. definitions of those variables, and the offsets of the compilation-units
  2464. that contain the definitions of those variables.
  2465.  
  2466. .H 3 "Debugger Interface Operations"
  2467.  
  2468. .DS
  2469. \f(CWint dwarf_get_vars(
  2470.         Dwarf_Debug dbg,
  2471.         Dwarf_Var **vars,
  2472.         Dwarf_Signed *var_count,
  2473.         Dwarf_Error *error)\fP
  2474. .DE
  2475. The function \f(CWdwarf_get_vars()\fP returns
  2476. \f(CWDW_DLV_OK\fP and sets \f(CW*var_count\fP to
  2477. the count of file-scope
  2478. static variable names represented in the section containing file-scope 
  2479. static variable names, i.e. .debug_varnames.  
  2480. It also stores, at \f(CW*vars\fP, a pointer to a list of 
  2481. \f(CWDwarf_Var\fP descriptors, one for each of the file-scope static
  2482. variable names in the .debug_varnames section.  
  2483. It returns \f(CWDW_DLV_ERROR\fP on error.
  2484. It returns \f(CWDW_DLV_NO_ENTRY\fP if the .debug_varnames section does 
  2485. not exist.  
  2486. On a successful return 
  2487. from this function, the \f(CWDwarf_Var\fP descriptors should be individually 
  2488. free'd using \f(CWdwarf_dealloc()\fP with the allocation type 
  2489. \f(CWDW_DLA_VAR\fP, followed by the deallocation of the list itself with 
  2490. the allocation type \f(CWDW_DLA_LIST\fP when the descriptors are no 
  2491. longer of interest.
  2492.  
  2493. .in +2
  2494. .DS
  2495. \f(CWDwarf_Signed cnt;
  2496. Dwarf_Var *vars;
  2497. int res;
  2498.  
  2499. if ((res = dwarf_get_vars(dbg, &vars,&cnt &error)) == DW_DLV_OK) {
  2500.  
  2501.         for (i = 0; i < cnt; ++i) {
  2502.                 /* use vars[i] */
  2503.                 dwarf_dealloc(dbg, vars[i], DW_DLA_VAR);
  2504.         }
  2505.         dwarf_dealloc(dbg, vars, DW_DLA_LIST);
  2506. }\fP
  2507. .DE
  2508. .in -2
  2509.  
  2510. .DS
  2511. \f(CWint dwarf_varname(
  2512.         Dwarf_Var var,
  2513.         char **    returned_name,
  2514.         Dwarf_Error *error)\fP
  2515. .DE
  2516. The function \f(CWdwarf_varname()\fP returns
  2517. \f(CWDW_DLV_OK\fP and sets \f(CW*returned_name\fP to
  2518. a pointer to a
  2519. null-terminated string that names the file-scope static variable represented 
  2520. by the \f(CWDwarf_Var\fP descriptor, \f(CWvar\fP.  
  2521. It returns \f(CWDW_DLV_ERROR\fP on error.  
  2522. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2523. On a successful return from this function, the string should
  2524. be free'd using \f(CWdwarf_dealloc()\fP, with the allocation type
  2525. \f(CWDW_DLA_STRING\fP when no longer of interest.
  2526.  
  2527. .DS
  2528. \f(CWint dwarf_var_die_offset(
  2529.         Dwarf_Var    var,
  2530.         Dwarf_Off   *returned_offset,
  2531.         Dwarf_Error *error)\fP
  2532. .DE
  2533. The function \f(CWdwarf_var_die_offset()\fP returns
  2534. \f(CWDW_DLV_OK\fP and sets \f(CW*returned_offset\fP to
  2535. the offset in
  2536. the section containing DIE's, i.e. .debug_info, of the DIE representing
  2537. the file-scope static variable that is described by the \f(CWDwarf_Var\fP 
  2538. descriptor, \f(CWvar\fP.  
  2539. It returns \f(CWDW_DLV_ERROR\fP on error.
  2540. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2541.  
  2542. .DS
  2543. \f(CWint dwarf_var_cu_offset(
  2544.         Dwarf_Var var,
  2545.         Dwarf_Off   *returned_offset,
  2546.         Dwarf_Error *error)\fP
  2547. .DE
  2548. The function \f(CWdwarf_var_cu_offset()\fP returns
  2549. \f(CWDW_DLV_OK\fP and sets \f(CW*returned_offset\fP to
  2550. the offset in
  2551. the section containing DIE's, i.e. .debug_info, of the compilation-unit
  2552. header of the compilation-unit that contains the file-scope static
  2553. variable described by the \f(CWDwarf_Var\fP descriptor, \f(CWvar\fP.  
  2554. It returns \f(CWDW_DLV_ERROR\fP on error.
  2555. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2556.  
  2557. .DS
  2558. \f(CWint dwarf_var_name_offsets(
  2559.         Dwarf_Var var,
  2560.     char     **returned_name,
  2561.         Dwarf_Off *die_offset,
  2562.         Dwarf_Off *cu_offset,
  2563.         Dwarf_Error *error)\fP
  2564. .DE
  2565. The function \f(CWdwarf_var_name_offsets()\fP returns
  2566. \f(CWDW_DLV_OK\fP and sets \f(CW*returned_name\fP to
  2567. a pointer to
  2568. a null-terminated string that gives the name of the file-scope
  2569. static variable described by the \f(CWDwarf_Var\fP descriptor \f(CWvar\fP.
  2570. It also returns in the locations
  2571. pointed to by \f(CWdie_offset\fP, and \f(CWcu_offset\fP, the offsets
  2572. of the DIE representing the file-scope static variable, and the 
  2573. compilation-unit header of the compilation-unit containing the 
  2574. file-scope static variable, respectively.  
  2575. It returns \f(CWDW_DLV_ERROR\fP on error.  
  2576. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2577. On a successful return from 
  2578. \f(CWdwarf_var_name_offsets()\fP the storage pointed to by
  2579. \f(CWreturned_name\fP
  2580. should be free'd using \f(CWdwarf_dealloc()\fP, with the allocation 
  2581. type \f(CWDW_DLA_STRING\fP when no longer of interest.
  2582.  
  2583. .H 2 "Macro Information Operations"
  2584. .H 3 "General Macro Operations"
  2585. .DS
  2586. \f(CWchar *dwarf_find_macro_value_start(char * macro_string);\fP
  2587. .DE
  2588. Given a macro string in the standard form defined in the DWARF
  2589. document ("name <space> value" or "name(args)<space>value")
  2590. this returns a pointer to the first byte of the macro value.
  2591. It does not alter the string pointed to by macro_string or copy
  2592. the string: it returns a pointer into the string whose
  2593. address was passed in.
  2594. .H 3 "Debugger Interface Macro Operations"
  2595. Macro information is accessed from the .debug_info section via the
  2596. DW_AT_macro_info attribute (whose value is an offset into .debug_macinfo).
  2597. .P
  2598. No Functions yet defined.
  2599. .H 3 "Low Level Macro Information Operations"
  2600. .DS
  2601. \f(CWint dwarf_get_macro_details(Dwarf_Debug /*dbg*/,
  2602.   Dwarf_Off              macro_offset,
  2603.   Dwarf_Unsigned         maximum_count,
  2604.   Dwarf_Signed         * entry_count,
  2605.   Dwarf_Macro_Details ** details,
  2606.   Dwarf_Error *          err);\fP
  2607. .DE
  2608. \f(CWdwarf_get_macro_details()\fP
  2609. returns  
  2610. \f(CWDW_DLV_OK\fP and sets
  2611. \f(CWentry_count\fP to the number of \f(CWdetails\fP records
  2612. returned through the \f(CWdetails\fP pointer.
  2613. The data returned thru  \f(CWdetails\fP should be freed
  2614. by a call to \f(CWdwarf_dealloc()\fP with the allocation type
  2615. \f(CWDW_DLA_STRING\fP.
  2616. If \f(CWDW_DLV_OK\fP is returned, the \f(CWentry_count\fP will
  2617. be at least 1, since
  2618. a compilation unit with macro information but no macros will
  2619. have at least one macro data byte of 0.
  2620. .P
  2621. \f(CWdwarf_get_macro_details()\fP
  2622. begins at the \f(CWmacro_offset\fP offset you supply
  2623. and ends at the end of a compilation unit or at \f(CWmaximum_count\fP
  2624. detail records (whichever comes first).
  2625. If \f(CWmaximum_count\fP is 0, it is treated as if it were the maximum
  2626. possible unsigned integer.
  2627. .P
  2628. \f(CWdwarf_get_macro_details()\fP
  2629. attempts to set \f(CWdmd_fileindex\fP to the correct file in every
  2630. \f(CWdetails\fP record. If it is unable to do so (or whenever
  2631. the current file index is unknown, it sets \f(CWdmd_fileindex\fP
  2632. to -1.
  2633. .P
  2634. \f(CWdwarf_get_macro_details()\fP returns \f(CWDW_DLV_ERROR\fP on error.
  2635. It returns \f(CWDW_DLV_NO_ENTRY\fP if there is no more
  2636. macro information at that \f(CWmacro_offset\fP. If \f(CWmacro_offset\fP
  2637. is passed in as 0, a \f(CWDW_DLV_NO_ENTRY\fP return means there is
  2638. no macro information.
  2639. .P
  2640. .in +2
  2641. .DS
  2642. \f(CWDwarf_Unsigned max = 0;
  2643. Dwarf_Off cur_off = 0;
  2644. Dwarf_Signed count = 0;
  2645. Dwarf_Macro_Details *maclist;
  2646. int errv;
  2647.  
  2648. /* loop thru all the compilation units macro info */
  2649. while((errv = dwarf_macro_details(dbg, cur_off,max,
  2650.      &count,&maclist,&error))== DW_DLV_OK) {
  2651.     for (i = 0; i < count; ++i) {
  2652.       /* use maclist[i] */
  2653.     }
  2654.     cur_off = maclist[count-1].dmd_offset + 1;
  2655.     dwarf_dealloc(dbg, maclist, DW_DLA_STRING);
  2656. }\fP
  2657. .DE
  2658.  
  2659.  
  2660. .H 2 "Low Level Frame Operations"
  2661. These functions provide information about stack frames to be
  2662. used to perform stack traces.  The information is an abstraction
  2663. of a table with a row per instruction and a column per register
  2664. and a column for the canonical frame address (CFA, which corresponds
  2665. to the frame pointer), as well as a column for the return address.  
  2666. Each cell in the table contains one of the following:
  2667.  
  2668. .AL 
  2669. .LI
  2670. A register + offset
  2671.  
  2672. .LI
  2673. A register
  2674.  
  2675. .LI
  2676. A marker (DW_FRAME_UNDEFINED_VAL) meaning \fIregister value undefined\fP
  2677.  
  2678. .LI
  2679. A marker (DW_FRAME_SAME_VAL) meaning \fIregister value same as in caller\fP
  2680. .LE
  2681.  
  2682. Figure \n(aX
  2683. is machine dependent and represents MIPS cpu register
  2684. assignments.
  2685. .DS
  2686. .TS
  2687. center box, tab(:);
  2688. lfB lfB lfB
  2689. l c l.
  2690. NAME:value:PURPOSE
  2691. _
  2692. DW_FRAME_CFA_COL:0:column used for CFA
  2693. DW_FRAME_REG1:1:integer regster 1
  2694. DW_FRAME_REG2:2:integer register 2
  2695. ---::obvious names and values here
  2696. DW_FRAME_REG30:30:integer register 30 
  2697. DW_FRAME_REG31:31:integer register 31
  2698. DW_FRAME_FREG0:32:floating point register 0
  2699. DW_FRAME_FREG1:33:floating point register 1
  2700. ---::obvious names and values here
  2701. DW_FRAME_FREG30:62:floating point register 30
  2702. DW_FRAME_FREG31:63:floating point register 31
  2703. DW_FRAME_RA_COL:64:column recording ra
  2704. DW_FRAME_UNDEFINED_VAL:1034:register val undefined
  2705. DW_FRAME_SAME_VAL:1035:register same as in caller
  2706. .TE
  2707.  
  2708. .FG "Frame Information Rule Assignments"
  2709. .DE
  2710.  
  2711. .P
  2712. The following table shows SGI/MIPS specific
  2713. special cell values: these values mean 
  2714. that the cell has the value \fIundefined\fP or \fIsame value\fP
  2715. respectively, rather than containing a \fIregister\fP or
  2716. \fIregister+offset\fP.  
  2717. .P
  2718. .DS
  2719. .TS
  2720. center box, tab(:);
  2721. lfB lfB lfB
  2722. l c l.
  2723. NAME:value:PURPOSE
  2724. _
  2725. DW_FRAME_UNDEFINED_VAL:1034:means undefined value.
  2726. ::Not a column or register value
  2727. DW_FRAME_SAME_VAL:1035:means 'same value' as
  2728. ::caller had. Not a column or 
  2729. ::register value
  2730. .TE
  2731. .FG "Frame Information Special Values"
  2732. .DE
  2733.  
  2734. .\"#if 0
  2735. .\".P
  2736. .\"Since the cie and fde entries are not "organized" by anything
  2737. .\"outside of the .debug_frame section one must scan them all to 
  2738. .\"find all entry addresses and lengths.  Since there is one fde 
  2739. .\"per function this can be a rather long list.
  2740. .\"#endif
  2741.  
  2742. .P
  2743. .DS
  2744. \f(CWint dwarf_get_fde_list(
  2745.         Dwarf_Debug dbg,
  2746.         Dwarf_Cie **cie_data,
  2747.         Dwarf_Signed *cie_element_count,
  2748.         Dwarf_Fde **fde_data,
  2749.         Dwarf_Signed *fde_element_count,
  2750.         Dwarf_Error *error);\fP
  2751. .DE
  2752. \f(CWdwarf_get_fde_list()\fP stores a pointer to a list of 
  2753. \f(CWDwarf_Cie\fP descriptors in \f(CW*cie_data\fP, and the 
  2754. count of the number of descriptors in \f(CW*cie_element_count\fP.  
  2755. There is a descriptor for each CIE in the .debug_frame section.  
  2756. Similarly, it stores a pointer to a list of \f(CWDwarf_Fde\fP 
  2757. descriptors in \f(CW*fde_data\fP, and the count of the number 
  2758. of descriptors in \f(CW*fde_element_count\fP.  There is one 
  2759. descriptor per FDE in the .debug_frame section.  
  2760. \f(CWdwarf_get_fde_list()\fP  returns \f(CWDW_DLV_EROR\fP on error.
  2761. It returns \f(CWDW_DLV_NO_ENTRY\fP if it cannot find frame entries.
  2762. It returns \f(CWDW_DLV_OK\fP on a successful return.
  2763.  
  2764. On successful return, each of the structures pointed to by a 
  2765. descriptor should be individually free'd using \f(CWdwarf_dealloc()\fP 
  2766. with either the allocation type \f(CWDW_DLA_CIE\fP, or \f(CWDW_DLA_FDE\fP 
  2767. as appropriate when no longer of interest.  Each of the blocks 
  2768. of descriptors should be free'd using \f(CWdwarf_dealloc()\fP with 
  2769. the allocation type \f(CWDW_DLA_LIST\fP when no longer of interest.
  2770.  
  2771.  
  2772. .in +2
  2773. .DS
  2774. \f(CWDwarf_Signed cnt;
  2775. Dwarf_Cie *cie_data;
  2776. Dwarf_Signed cie_count;
  2777. Dwarf_Fde *fde_data;
  2778. Dwarf_Signed fde_count;
  2779. int fres;
  2780.  
  2781. if ((fres = dwarf_get_fde_list(dbg,&cie_data,&cie_count, 
  2782.         &fde_data,&fde_count,&error)) == DW_DLV_OK) {
  2783.  
  2784.         for (i = 0; i < cie_count; ++i) {
  2785.                 /* use cie[i] */
  2786.                 dwarf_dealloc(dbg, cie_data[i], DW_DLA_CIE);
  2787.         }
  2788.         for (i = 0; i < fde_count; ++i) {
  2789.                 /* use fde[i] */
  2790.                 dwarf_dealloc(dbg, fde_data[i], DW_DLA_FDE);
  2791.         }
  2792.         dwarf_dealloc(dbg, cie_data, DW_DLA_LIST);
  2793.         dwarf_dealloc(dbg, fde_data, DW_DLA_LIST);
  2794. }\fP
  2795. .DE
  2796. .in -2
  2797.  
  2798. .P
  2799. Each \f(CWDwarf_Fde\fP descriptor describes information about the
  2800. frame for a particular subroutine or function.
  2801.  
  2802. \f(CWint dwarf_get_fde_for_die\fPis SGI/MIPS specific.
  2803.  
  2804. .DS
  2805. \f(CWint dwarf_get_fde_for_die(
  2806.         Dwarf_Debug dbg,
  2807.         Dwarf_Die die,
  2808.         Dwarf_Fde *  return_fde,
  2809.         Dwarf_Error *error)\fP
  2810. .DE
  2811. When it succeeds,
  2812. \f(CWdwarf_get_fde_for_die()\fP returns 
  2813. \f(CWDW_DLV_OK\fP and sets \f(CW*return_fde\fP
  2814. to
  2815. a \f(CWDwarf_Fde\fP
  2816. descriptor representing frame information for the given \f(CWdie\fP.  It 
  2817. looks for the \f(CWDW_AT_MIPS_fde\fP attribute in the given \f(CWdie\fP.
  2818. If it finds it, is uses the value of the attribute as the offset in 
  2819. the .debug_frame section where the FDE begins.
  2820. If there is no \f(CWDW_AT_MIPS_fde\fP it returns \f(CWDW_DLV_NO_ENTRY\fP.
  2821. If there is an error it returns \f(CWDW_DLV_ERROR\fP.
  2822.  
  2823. .DS
  2824. \f(CWint dwarf_get_fde_range(
  2825.         Dwarf_Fde fde,
  2826.         Dwarf_Addr *low_pc,
  2827.         Dwarf_Unsigned *func_length,
  2828.         Dwarf_Ptr *fde_bytes,
  2829.         Dwarf_Unsigned *fde_byte_length,
  2830.         Dwarf_Off *cie_offset,
  2831.         Dwarf_Signed *cie_index,
  2832.         Dwarf_Off *fde_offset,
  2833.         Dwarf_Error *error);\fP
  2834. .DE
  2835. On success,
  2836. \f(CWdwarf_get_fde_range()\fP returns
  2837. \f(CWDW_DLV_OK\fP.
  2838. The location pointed to by \f(CWlow_pc\fP is set to the low pc value for
  2839. this function.  
  2840. The location pointed to by \f(CWfunc_length\fP is 
  2841. set to the length of the function in bytes.  
  2842. This is essentially the
  2843. length of the text section for the function.  
  2844. The location pointed
  2845. to by \f(CWfde_bytes\fP is set to the address where the FDE begins
  2846. in the .debug_frame section.  
  2847. The location pointed to by 
  2848. \f(CWfde_byte_length\fP is set to the length in bytes of the portion
  2849. of .debug_frame for this FDE.  
  2850. This is the same as the value returned
  2851. by \f(CWdwarf_get_fde_range\fP.  
  2852. The location pointed to by 
  2853. \f(CWcie_offset\fP is set to the offset in the .debug_frame section
  2854. of the CIE used by this FDE.  
  2855. The location pointed to by \f(CWcie_index\fP
  2856. is set to the index of the CIE used by this FDE.  
  2857. The index is the 
  2858. index of the CIE in the list pointed to by \f(CWcie_data\fP as set 
  2859. by the function \f(CWdwarf_get_fde_list()\fP.  
  2860. However, if the function
  2861. \f(CWdwarf_get_fde_for_die()\fP was used to obtain the given \f(CWfde\fP, 
  2862. this index may not be correct.   
  2863. The location pointed to by 
  2864. \f(CWfde_offset\fP is set to the offset of the start of this FDE in 
  2865. the .debug_frame section.  
  2866. \f(CWdwarf_get_fde_range()\fP returns \f(CWDW_DLV_ERROR\fP on error.
  2867.  
  2868. .DS
  2869. \f(CWint dwarf_get_cie_info(
  2870.         Dwarf_Cie       cie,
  2871.     Dwarf_Unsigned *bytes_in_cie,
  2872.         Dwarf_Small    *version,
  2873.         char          **augmenter,
  2874.         Dwarf_Unsigned *code_alignment_factor,
  2875.         Dwarf_Signed *data_alignment_factor,
  2876.         Dwarf_Half     *return_address_register_rule,
  2877.         Dwarf_Ptr      *initial_instructions,
  2878.         Dwarf_Unsigned *initial_instructions_length,
  2879.         Dwarf_Error    *error);\fP
  2880. .DE
  2881. \f(CWdwarf_get_cie_info()\fP is primarily for Internal-level Interface 
  2882. consumers.  
  2883. If successful,
  2884. it returns
  2885. \f(CWDW_DLV_OK\fP and sets \f(CW*bytes_in_cie\fP to
  2886. the number of bytes in the portion of the
  2887. frames section for the CIE represented by the given \f(CWDwarf_Cie\fP
  2888. descriptor, \f(CWcie\fP.  
  2889. The other fields are directly taken from 
  2890. the cie and returned, via the pointers to the caller.  
  2891. It returns \f(CWDW_DLV_ERROR\fP on error.
  2892.  
  2893. .DS
  2894. \f(CWint dwarf_get_fde_instr_bytes(
  2895.         Dwarf_Fde fde,
  2896.     Dwarf_Ptr *outinstrs,
  2897.     Dwarf_Unsigned *outlen,
  2898.         Dwarf_Error *error);\fP
  2899. .DE
  2900. \f(CWdwarf_get_fde_instr_bytes()\fP returns
  2901. \f(CWDW_DLV_OK\fP and sets \f(CW*outinstrs\fP to
  2902. a pointer to a set of bytes which are the
  2903. actual frame instructions for this fde.
  2904. It also sets \f(CW*outlen\fP to the length, in
  2905. bytes, of the frame instructions.
  2906. It returns \f(CWDW_DLV_ERROR\fP on error.
  2907. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  2908. The intent is to allow low-level consumers like a dwarf-dumper
  2909. to print the bytes in some fashion.
  2910. The memory pointed to by \f(CWoutinstrs\fP
  2911. must not be changed and there
  2912. is nothing to free.
  2913.  
  2914. .DS
  2915. \f(CWint dwarf_get_fde_info_for_reg(
  2916.         Dwarf_Fde fde,
  2917.         Dwarf_Half table_column,
  2918.         Dwarf_Addr pc_requested,
  2919.     Dwarf_Signed *offset_relevant,
  2920.         Dwarf_Signed *register_num,
  2921.         Dwarf_Signed *offset,
  2922.         Dwarf_Addr *row_pc,
  2923.         Dwarf_Error *error);\fP
  2924. .DE
  2925. \f(CWdwarf_get_fde_info_for_reg()\fP returns
  2926. \f(CWDW_DLV_OK\fP and sets \f(CW*offset_relevant\fP to
  2927. non-zero if the offset is relevant for the
  2928. row specified by \f(CWpc_requested\fP and column specified by
  2929. \f(CWtable_column\fP, for the FDE specified by \f(CWfde\fP.  
  2930. The
  2931. intent is to return the rule for the given pc value and register.
  2932. The location pointed to by \f(CWregister_num\fP is set to the register
  2933. value for the rule.  
  2934. The location pointed to by \f(CWoffset\fP 
  2935. is set to the offset value for the rule.  
  2936. If offset is not relevant for this rule, \f(CW*offset_relevant\fP is
  2937. set to zero.
  2938. Since more than one pc 
  2939. value will have rows with identical entries, the user may want to
  2940. know the earliest pc value after which the rules for all the columns
  2941. remained unchanged.  
  2942. Recall that in the virtual table that the frame information
  2943. represents there may be one or more table rows with identical data
  2944. (each such table row at a different pc value).
  2945. Given a \f(CWpc_requested\fP which refers to a pc in such a group
  2946. of identical rows, 
  2947. the location pointed to by \f(CWrow_pc\fP is set 
  2948. to the lowest pc value
  2949. within the group of  identical rows.
  2950. The  value put in \f(CW*register_num\fP any of the
  2951. \f(CWDW_FRAME_*\fP table columns values specified in \f(CWlibdwarf.h\fP
  2952. or \f(CWdwarf.h\fP.
  2953.  
  2954. \f(CWdwarf_get_fde_info_for_reg\fP returns \f(CWDW_DLV_ERROR\fP if there is an error. 
  2955.  
  2956. It is usable with either 
  2957. \f(CWdwarf_get_fde_n()\fP or \f(CWdwarf_get_fde_at_pc()\fP.
  2958.  
  2959. .DS
  2960. \f(CWint dwarf_get_fde_info_for_all_regs(
  2961.         Dwarf_Fde fde,
  2962.         Dwarf_Addr pc_requested,
  2963.     Dwarf_Regtable *reg_table,
  2964.         Dwarf_Addr *row_pc,
  2965.         Dwarf_Error *error);\fP
  2966. .DE
  2967. \f(CWdwarf_get_fde_info_for_all_regs()\fP returns
  2968. \f(CWDW_DLV_OK\fP and sets \f(CW*reg_table\fP for the row specified by
  2969. \f(CWpc_requested\fP for the FDE specified by \f(CWfde\fP. The intent is
  2970. to return the rules for decoding all the registers, given a pc value.
  2971. \f(CWreg_table\fP is an array of rules, one for each register specified in
  2972. \f(CWdwarf.h\fP. The rule for each register contains three items - 
  2973. \f(CWdw_regnum\fP which denotes the register value for that rule,
  2974. \f(CWdw_offset\fP which denotes the offset value for that rule and 
  2975. \f(CWdw_offset_relevant\fP which is set to zero if offset is not relevant 
  2976. for that rule. See \f(CWdwarf_get_fde_info_fo_reg()\fP for a description 
  2977. of \f(CWrow_pc\fP.
  2978.  
  2979. \f(CWdwarf_get_fde_info_for_all_regs\fP returns \f(CWDW_DLV_ERROR\fP if there is an error. 
  2980.  
  2981. \f(CWint dwarf_get_fde_info_for_all_regs\fP is SGI/MIPS specific.
  2982. .DS
  2983. \f(CWint   dwarf_get_fde_n(
  2984.         Dwarf_Fde *fde_data,
  2985.         Dwarf_Unsigned fde_index,
  2986.     Dwarf_Fde      *returned_fde
  2987.         Dwarf_Error *error);\fP
  2988. .DE
  2989. \f(CWdwarf_get_fde_n()\fP returns
  2990. \f(CWDW_DLV_OK\fP and sets \f(CWreturned_fde\fP to
  2991. the \f(CWDwarf_Fde\fP descriptor whose 
  2992. index is \f(CWfde_index\fP in the table of \f(CWDwarf_Fde\fP descriptors
  2993. pointed to by \fPfde_data\fP.  
  2994. The index starts with 0.  
  2995. Returns \f(CWDW_DLV_NO_ENTRY\fP if the index does not 
  2996. exist in the table of \f(CWDwarf_Fde\fP 
  2997. descriptors. 
  2998. Returns \f(CWDW_DLV_ERROR\fP if there is an error.
  2999. This function cannot be used unless
  3000. the block of \f(CWDwarf_Fde\fP descriptors has been created by a call to
  3001. \f(CWdwarf_get_fde_list()\fP.
  3002.  
  3003. .DS
  3004. \f(CWint   dwarf_get_fde_at_pc(
  3005.         Dwarf_Fde *fde_data,
  3006.         Dwarf_Addr pc_of_interest,
  3007.         Dwarf_Fde *returned_fde,
  3008.         Dwarf_Addr *lopc,
  3009.         Dwarf_Addr *hipc,
  3010.         Dwarf_Error *error);\fP
  3011. .DE
  3012. \f(CWdwarf_get_fde_at_pc()\fP returns
  3013. \f(CWDW_DLV_OK\fP and sets \f(CWreturned_fde\fP to
  3014. a \f(CWDwarf_Fde\fP descriptor
  3015. for a function which contains the pc value specified by \f(CWpc_of_interest\fP.
  3016. In addition, it sets the locations pointed to 
  3017. by \f(CWlopc\fP and \f(CWhipc\fP to the low address and the high address 
  3018. covered by this FDE, respectively.  
  3019. It returns \f(CWDW_DLV_ERROR\fP on error.
  3020. It returns \f(CWDW_DLV_NO_ENTRY\fP 
  3021. if \f(CWpc_of_interest\fP is not in any of the
  3022. FDEs represented by the block of \f(CWDwarf_Fde\fP descriptors pointed
  3023. to by \f(CWfde_data\fP.  
  3024. This function cannot be used unless
  3025. the block of \f(CWDwarf_Fde\fP descriptors has been created by a call to
  3026. \f(CWdwarf_get_fde_list()\fP.
  3027.  
  3028. .DS
  3029. \f(CWint dwarf_expand_frame_instructions(
  3030.         Dwarf_Debug dbg,
  3031.         Dwarf_Ptr instruction,
  3032.         Dwarf_Unsigned i_length,
  3033.         Dwarf_Frame_Op **returned_op_list,
  3034.         Dwarf_Signed   * returned_op_count,
  3035.         Dwarf_Error *error);\fP
  3036. .DE
  3037. \f(CWdwarf_expand_frame_instructions()\fP is a High-level interface 
  3038. function which expands a frame instruction byte stream into an 
  3039. array of \f(CWDwarf_Frame_Op\fP structures.  
  3040. To indicate success, it returns \f(CWDW_DLV_OK\fP.
  3041. The address where 
  3042. the byte stream begins is specified by \f(CWinstruction\fP, and
  3043. the length of the byte stream is specified by \f(CWi_length\fP.
  3044. The location pointed to by \f(CWreturned_op_list\fP is set to
  3045. point to a table of 
  3046. \f(CWreturned_op_count\fP
  3047. pointers to \f(CWDwarf_Frame_Op\fP which
  3048. contain the frame instructions in the byte stream.  
  3049. It returns \f(CWDW_DLV_ERROR\fP on error. 
  3050. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  3051. After a successful return, the
  3052. array of structures should be freed using
  3053. \f(CWdwarf_dealloc()\fP with the allocation type \f(CWDW_DLA_FRAME_BLOCK\fP
  3054. (when they are no longer of interest).
  3055.  
  3056. .in +2
  3057. .DS
  3058. \f(CWDwarf_Signed cnt;
  3059. Dwarf_Frame_Op *frameops;
  3060. Dwarf_Ptr instruction;
  3061. Dwarf_Unsigned len;
  3062. int res;
  3063.  
  3064. if (expand_frame_instructions(dbg,instruction,len, &frameops,&cnt, &error)
  3065.          == DW_DLV_OK) {
  3066.  
  3067.         for (i = 0; i < cnt; ++i) {
  3068.                 /* use frameops[i] */
  3069.         }
  3070.         dwarf_dealloc(dbg, frameops, DW_DLA_FRAME_BLOCK);
  3071. }\fP
  3072. .DE
  3073. .in -2
  3074.  
  3075.  
  3076. .H 2 "Location Expression Evaluation"
  3077.  
  3078. An "interpreter" which evaluates a location expression
  3079. is required in any debugger.  There is no interface defined
  3080. here at this time.  
  3081.  
  3082. .P
  3083. One problem with defining an interface is that operations are
  3084. machine dependent: they depend on the interpretation of
  3085. register numbers and the methods of getting values from the
  3086. environment the expression is applied to.
  3087.  
  3088. .P
  3089. It would be desirable to specify an interface.
  3090.  
  3091. .H 3 "Location List Internal-level Interface"
  3092.  
  3093. .DS
  3094. \f(CWint dwarf_get_loclist_entry(
  3095.         Dwarf_Debug dbg,
  3096.         Dwarf_Unsigned offset,
  3097.         Dwarf_Addr *hipc_offset,
  3098.         Dwarf_Addr *lopc_offset,
  3099.         Dwarf_Ptr *data,
  3100.         Dwarf_Unsigned *entry_len,
  3101.         Dwarf_Unsigned *next_entry,
  3102.         Dwarf_Error *error)\fP
  3103. .DE
  3104. \f(CWdwarf_dwarf_get_loclist_entry()\fP returns 
  3105. \f(CWDW_DLV_OK\fP if successful.
  3106. \f(CWDW_DLV_ERROR\fP is returned on error. 
  3107. The function reads 
  3108. a location list entry starting at \f(CWoffset\fP and returns 
  3109. through pointers (when successful)
  3110. the high pc \f(CWhipc_offset\fP, low pc 
  3111. \f(CWlopc_offset\fP, a pointer to the location description data 
  3112. \f(CWdata\fP, the length of the location description data 
  3113. \f(CWentry_len\fP, and the offset of the next location description 
  3114. entry \f(CWnext_entry\fP.  
  3115. When \f(CWhipc\fP and \f(CWlopc\fP are 
  3116. zero, this is the end of a particular location list.  
  3117.  
  3118. .P
  3119. The \f(CWhipc_offset\fP,
  3120. low pc \f(CWlopc_offset\fP are offsets from the beginning of the
  3121. current procedure, not genuine pc values.
  3122.  
  3123. .H 2 "Abbreviations access"
  3124. These are Internal-level Interface functions.  
  3125. Debuggers can ignore this.
  3126.  
  3127. .DS
  3128. \f(CWint dwarf_get_abbrev(
  3129.         Dwarf_Debug dbg,
  3130.         Dwarf_Unsigned offset,
  3131.         Dwarf_Abbrev   *returned_abbrev,
  3132.         Dwarf_Unsigned *length,
  3133.         Dwarf_Unsigned *attr_count,
  3134.         Dwarf_Error *error)\fP
  3135. .DE
  3136. The function \f(CWdwarf_get_abbrev()\fP returns
  3137. \f(CWDW_DLV_OK\fP and sets \f(CW*returned_fde\fP to
  3138. \f(CWDwarf_Abbrev\fP 
  3139. descriptor for an abbreviation at offset \f(CW*offset\fP in the abbreviations 
  3140. section (i.e .debug_abbrev) on success.  
  3141. The user is responsible for making sure that 
  3142. a valid abbreviation begins at \f(CWoffset\fP in the abbreviations section.  
  3143. The location pointed to by \f(CWlength\fP 
  3144. is set to the length in bytes of the abbreviation in the abbreviations 
  3145. section.  
  3146. The location pointed to by \f(CWattr_count\fP is set to the 
  3147. number of attributes in the abbreviation.  
  3148. An abbreviation entry with a 
  3149. length of 1 is the 0 byte of the last abbreviation entry of a compilation 
  3150. unit.
  3151. \f(CWdwarf_get_abbrev()\fP returns \f(CWDW_DLV_ERROR\fP on error.  
  3152.  
  3153. .DS
  3154. \f(CWint dwarf_get_abbrev_tag(
  3155.         Dwarf_abbrev abbrev,
  3156.     Dwarf_Half  *return_tag,
  3157.         Dwarf_Error *error);\P
  3158. .DE
  3159. If successfull,
  3160. \f(CWdwarf_get_abbrev_tag()\fP returns
  3161. \f(CWDW_DLV_OK\fP and sets \f(CW*return_tag\fP to
  3162. the \fItag\fP of 
  3163. the given abbreviation.
  3164. It returns \f(CWDW_DLV_ERROR\fP on error.
  3165. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  3166.  
  3167. .DS
  3168. \f(CWint dwarf_get_abbrev_code(
  3169.         Dwarf_abbrev     abbrev,
  3170.     Dwarf_Unsigned  *return_code,
  3171.         Dwarf_Error     *error);\P
  3172. .DE
  3173. If successfull,
  3174. \f(CWdwarf_get_abbrev_code()\fP returns
  3175. \f(CWDW_DLV_OK\fP and sets \f(CW*return_code\fP to
  3176. the abbreviation code of
  3177. the given abbreviation.
  3178. It returns \f(CWDW_DLV_ERROR\fP on error.
  3179. It never returns \f(CWDW_DLV_NO_ENTRY\fP.
  3180.  
  3181. .DS
  3182. \f(CWint dwarf_get_abbrev_children_flag(
  3183.         Dwarf_Abbrev abbrev,
  3184.     Dwarf_Signed  *returned_flag,
  3185.         Dwarf_Error *error)\fP
  3186. .DE
  3187. The function \f(CWdwarf_get_abbrev_children_flag()\fP returns 
  3188. \f(CWDW_DLV_OK\fP and sets \f(CWreturned_flag\fP to
  3189. \f(CWDW_children_no\fP (if the given abbreviation indicates that 
  3190. a die with that abbreviation has no children) or 
  3191. \f(CWDW_children_yes\fP (if the given abbreviation indicates that 
  3192. a die with that abbreviation has a child).  
  3193. It returns \f(CWDW_DLV_ERROR\fP on error.
  3194.  
  3195. .DS
  3196. \f(CWint dwarf_get_abbrev_entry(
  3197.         Dwarf_Abbrev abbrev,
  3198.         Dwarf_Signed index,
  3199.         Dwarf_Half   *attr_num,
  3200.         Dwarf_Signed *form,
  3201.         Dwarf_Off *offset,
  3202.         Dwarf_Error *error)\fP
  3203.  
  3204. .DE
  3205. If successful,
  3206. \f(CWdwarf_get_abbrev_entry()\fP returns
  3207. \f(CWDW_DLV_OK\fP and sets \f(CW*attr_num\fP to the attribute code of
  3208. the attribute 
  3209. whose index is specified by \f(CWindex\fP in the given abbreviation.  
  3210. The index starts at 0.  
  3211. The location pointed to by \f(CWform\fP is set 
  3212. to the form of the attribute.  
  3213. The location pointed to by \f(CWoffset\fP 
  3214. is set to the byte offset of the attribute in the abbreviations section.  
  3215. It returns \f(CWDW_DLV_NO_ENTRY\fP if the index specified is outside
  3216. the range of attributes in this abbreviation.
  3217. It returns \f(CWDW_DLV_ERROR\fP on error.
  3218.  
  3219. .H 2 "String Section Operations"
  3220. The .debug_str section contains only strings.  Debuggers need 
  3221. never use this interface: it is only for debugging problems with 
  3222. the string section itself.  
  3223.  
  3224. .DS
  3225. \f(CWint dwarf_get_str(
  3226.         Dwarf_Debug   dbg,
  3227.         Dwarf_Off     offset,
  3228.         char        **string,
  3229.     Dwarf_Signed  returned_str_len,
  3230.         Dwarf_Error *error)\fP
  3231. .DE
  3232. The function \f(CWdwarf_get_str()\fP returns
  3233. \f(CWDW_DLV_OK\fP and sets \f(CW*returned_str_len\fP to
  3234. the length of 
  3235. the string, not counting the null terminator, that begins at the offset 
  3236. specified by \f(CWoffset\fP in the .debug_str section.  
  3237. The location 
  3238. pointed to by \f(CWstring\fP is set to a pointer to this string.
  3239. The next string in the .debug_str
  3240. section begins at the previous \f(CWoffset\fP + 1 + \f(CW*returned_str_len\fP.
  3241. A zero-length string is NOT the end of the section.
  3242. If there is no .debug_str section, \f(CWDW_DLV_NO_ENTRY\fP is returned.
  3243. If there is an error, \f(CWDW_DLV_ERROR\fP is returned.
  3244.  
  3245. .H 2 "Address Range Operations"
  3246. These functions provide information about address ranges.  Address
  3247. ranges map ranges of pc values to the corresponding compilation-unit
  3248. die that covers the address range.
  3249.  
  3250. .DS
  3251. \f(CWint dwarf_get_aranges(
  3252.         Dwarf_Debug dbg,
  3253.         Dwarf_Arange **aranges,
  3254.         Dwarf_Signed * returned_arange_count,
  3255.         Dwarf_Error *error)\fP
  3256. .DE
  3257. The function \f(CWdwarf_get_aranges()\fP returns 
  3258. \f(CWDW_DLV_OK\fP and sets \f(CW*returned_arange_count\fP to
  3259. the count of the
  3260. number of address ranges in the .debug_aranges section.  
  3261. It sets
  3262. \f(CW*aranges\fP to point to a block of \f(CWDwarf_Arange\fP 
  3263. descriptors, one for each address range.  
  3264. It returns \f(CWDW_DLV_ERROR\fP on error.
  3265. It returns \f(CWDW_DLV_NO_ENTRY\fP if there is no .debug_aranges
  3266. section.
  3267.  
  3268. .in +2
  3269. .DS
  3270. \f(CWDwarf_Signed cnt;
  3271. Dwarf_Arange *arang;
  3272.  
  3273. if ((dwarf_get_aranges(dbg, &arang,&cnt, &error)) == DW_DLV_OK) {
  3274.  
  3275.         for (i = 0; i < cnt; ++i) {
  3276.                 /* use arang[i] */
  3277.                 dwarf_dealloc(dbg, arang[i], DW_DLA_ARANGE);
  3278.         }
  3279.         dwarf_dealloc(dbg, arang, DW_DLA_LIST);
  3280. }\fP
  3281. .DE
  3282. .in -2
  3283.  
  3284.  
  3285. .DS
  3286. \f(CWint dwarf_get_arange(
  3287.         Dwarf_Arange *aranges,
  3288.         Dwarf_Unsigned arange_count,
  3289.         Dwarf_Addr address,
  3290.     Dwarf_Arange   *returned_arange,
  3291.         Dwarf_Error *error)\fP
  3292. .DE
  3293. The function \f(CWdwarf_get_arange()\fP takes as input a pointer 
  3294. to a block of \f(CWDwarf_Arange\fP pointers, and a count of the
  3295. number of descriptors in the block.  
  3296. It then searches for the
  3297. descriptor that covers the given \f(CWaddress\fP.  
  3298. If it finds
  3299. one, it returns
  3300. \f(CWDW_DLV_OK\fP and sets \f(CW*returned_arange\fP to
  3301. the descriptor. 
  3302. It returns \f(CWDW_DLV_ERROR\fP on error.
  3303. It returns \f(CWDW_DLV_NO_ENTRY\fP if there is no .debug_aranges
  3304. entry covering that address.
  3305.  
  3306.  
  3307. .DS
  3308. \f(CWDwarf_Off dwarf_get_cu_die_offset(
  3309.         Dwarf_Arange arange,
  3310.         Dwarf_Off   *returned_offset,
  3311.         Dwarf_Error *error)\fP
  3312. .DE
  3313. The function \f(CWdwarf_get_cu_die_offset()\fP takes a
  3314. \f(CWDwarf_Arange\fP descriptor as input, and 
  3315. if successful returns
  3316. \f(CWDW_DLV_OK\fP and sets \f(CW*returned_offset\fP to
  3317. the offset
  3318. in the .debug_info section of the compilation-unit DIE for the 
  3319. compilation-unit represented by the given address range.
  3320. It returns \f(CWDW_DLV_ERROR\fP on error.
  3321.  
  3322. .DS
  3323. \f(CWint dwarf_get_arange_info(
  3324.         Dwarf_Arange arange,
  3325.         Dwarf_Addr *start,
  3326.         Dwarf_Unsigned *length,
  3327.         Dwarf_Off *cu_die_offset,
  3328.         Dwarf_Error *error)\fP
  3329. .DE
  3330. The function \f(CWdwarf_get_arange_info()\fP returns
  3331. \f(CWDW_DLV_OK\fP
  3332. and
  3333. stores the starting value of the address range in the location pointed 
  3334. to by \f(CWstart\fP, the length of the address range in the location 
  3335. pointed to by \f(CWlength\fP, and the offset in the .debug_info section 
  3336. of the compilation-unit DIE for the compilation-unit represented by the 
  3337. address range.
  3338. It returns \f(CWDW_DLV_ERROR\fP on error.
  3339.  
  3340. .H 2 "General Low Level Operations"
  3341. This function is low-level and intended for use only
  3342. by programs such as dwarf-dumpers.
  3343.  
  3344. .DS
  3345. \f(CWint dwarf_get_address_size(Dwarf_Debug dbg,
  3346.     Dwarf_Half  *addr_size,
  3347.         Dwarf_Error *error)\fP
  3348. .DE
  3349. The function \f(CWdwarf_get_address_size()\fP 
  3350. returns \f(CWDW_DLV_OK\fP on success and sets 
  3351. the \f(CW*addr_size\fP
  3352. to the size in bytes of an address.
  3353. In case of error, it returns \f(CWDW_DLV_ERROR\fP
  3354. and does not set \f(CW*addr_size\fP.
  3355.  
  3356.  
  3357. .H 2 "Utility Operations"
  3358. These functions aid in the management of errors encountered when using 
  3359. functions in the \fIlibdwarf\fP library and releasing memory allocated 
  3360. as a result of a \fIlibdwarf\fP operation. 
  3361.  
  3362. .DS
  3363. \f(CWDwarf_Unsigned dwarf_errno(
  3364.         Dwarf_Error error)\fP
  3365. .DE
  3366. The function \f(CWdwarf_errno()\fP returns the error number corresponding 
  3367. to the error specified by \f(CWerror\fP.
  3368.  
  3369. .DS
  3370. \f(CWconst char* dwarf_errmsg(
  3371.         Dwarf_Error error)\fP
  3372. .DE
  3373. The function \f(CWdwarf_errmsg()\fP returns a pointer to a
  3374. null-terminated error message string corresponding to the error specified by 
  3375. \f(CWerror\fP.  
  3376. The string returned by \f(CWdwarf_errmsg()\fP 
  3377. should not be deallocated using \f(CWdwarf_dealloc()\fP.
  3378.  
  3379. .P
  3380. The set of errors 
  3381. enumerated in Figure \n(aX below were defined in Dwarf 1.
  3382. These errors are not used by the current implementation
  3383. of Dwarf 2.  
  3384. .DS
  3385. .TS
  3386. center box, tab(:);
  3387. lfB lfB 
  3388. l l.
  3389. SYMBOLIC NAME:DESCRIPTION
  3390. _
  3391. DW_DLE_NE:No error (0)
  3392. DW_DLE_VMM:Version of DWARF information newer than libdwarf
  3393. DW_DLE_MAP:Memory map failure
  3394. DW_DLE_LEE:Propagation of libelf error
  3395. DW_DLE_NDS:No debug section
  3396. DW_DLE_NLS:No line section
  3397. DW_DLE_ID:Requested information not associated with descriptor
  3398. DW_DLE_IOF:I/O failure
  3399. DW_DLE_MAF:Memory allocation failure
  3400. DW_DLE_IA:Invalid argument
  3401. DW_DLE_MDE:Mangled debugging entry
  3402. DW_DLE_MLE:Mangled line number entry
  3403. DW_DLE_FNO:File descriptor does not refer to an open file
  3404. DW_DLE_FNR:File is not a regular file
  3405. DW_DLE_FWA:File is opened with wrong access
  3406. DW_DLE_NOB:File is not an object file
  3407. DW_DLE_MOF:Mangled object file header
  3408. DW_DLE_EOLL:End of location list entries
  3409. DW_DLE_NOLL:No location list section
  3410. DW_DLE_BADOFF:Invalid offset
  3411. DW_DLE_EOS:End of section
  3412. DW_DLE_ATRUNC:Abbreviations section appears truncated
  3413. DW_DLE_BADBITC:Address size passed to dwarf bad
  3414. .TE
  3415. .FG "List of Dwarf Error Codes"
  3416. .DE
  3417.  
  3418. The set of errors returned by SGI \f(CWLibdwarf\fP functions
  3419. is listed below.
  3420. Some of the errors are SGI specific.
  3421.  
  3422. .DS
  3423. .TS
  3424. center box, tab(:);
  3425. lfB lfB
  3426. l l.
  3427. SYMBOLIC NAME:DESCRIPTION
  3428. _
  3429. DW_DLE_DBG_ALLOC:Could not allocate Dwarf_Debug struct
  3430. DW_DLE_FSTAT_ERROR:Error in fstat()-ing object
  3431. DW_DLE_FSTAT_MODE_ERROR:Error in mode of object file
  3432. DW_DLE_INIT_ACCESS_WRONG:Incorrect access to dwarf_init()
  3433. DW_DLE_ELF_BEGIN_ERROR:Error in elf_begin() on object
  3434. DW_DLE_ELF_GETEHDR_ERROR:Error in elf_getehdr() on object
  3435. DW_DLE_ELF_GETSHDR_ERROR:Error in elf_getshdr() on object
  3436. DW_DLE_ELF_STRPTR_ERROR:Error in elf_strptr() on object
  3437. DW_DLE_DEBUG_INFO_DUPLICATE:Multiple .debug_info sections
  3438. DW_DLE_DEBUG_INFO_NULL:No data in .debug_info section
  3439. DW_DLE_DEBUG_ABBREV_DUPLICATE:Multiple .debug_abbrev sections
  3440. DW_DLE_DEBUG_ABBREV_NULL:No data in .debug_abbrev section
  3441. DW_DLE_DEBUG_ARANGES_DUPLICATE:Multiple .debug_arange sections
  3442. DW_DLE_DEBUG_ARANGES_NULL:No data in .debug_arange section
  3443. DW_DLE_DEBUG_LINE_DUPLICATE:Multiple .debug_line sections
  3444. DW_DLE_DEBUG_LINE_NULL:No data in .debug_line section
  3445. DW_DLE_DEBUG_LOC_DUPLICATE:Multiple .debug_loc sections
  3446. DW_DLE_DEBUG_LOC_NULL:No data in .debug_loc section
  3447. DW_DLE_DEBUG_MACINFO_DUPLICATE:Multiple .debug_macinfo sections
  3448. DW_DLE_DEBUG_MACINFO_NULL:No data in .debug_macinfo section
  3449. DW_DLE_DEBUG_PUBNAMES_DUPLICATE:Multiple .debug_pubnames sections
  3450. DW_DLE_DEBUG_PUBNAMES_NULL:No data in .debug_pubnames section
  3451. DW_DLE_DEBUG_STR_DUPLICATE:Multiple .debug_str sections
  3452. DW_DLE_DEBUG_STR_NULL:No data in .debug_str section
  3453. DW_DLE_CU_LENGTH_ERROR:Length of compilation-unit bad
  3454. DW_DLE_VERSION_STAMP_ERROR:Incorrect Version Stamp
  3455. DW_DLE_ABBREV_OFFSET_ERROR:Offset in .debug_abbrev bad
  3456. DW_DLE_ADDRESS_SIZE_ERROR:Size of addresses in target bad
  3457. DW_DLE_DEBUG_INFO_PTR_NULL:Pointer into .debug_info in DIE null
  3458. DW_DLE_DIE_NULL:Null Dwarf_Die
  3459. DW_DLE_STRING_OFFSET_BAD:Offset in .debug_str bad
  3460. DW_DLE_DEBUG_LINE_LENGTH_BAD:Length of .debug_line segment bad
  3461. DW_DLE_LINE_PROLOG_LENGTH_BAD:Length of .debug_line prolog bad
  3462. DW_DLE_LINE_NUM_OPERANDS_BAD:Number of operands to line instr bad
  3463. DW_DLE_LINE_SET_ADDR_ERROR:Error in DW_LNE_set_address instruction
  3464. DW_DLE_LINE_EXT_OPCODE_BAD:Error in DW_EXTENDED_OPCODE instruction
  3465. DW_DLE_DWARF_LINE_NULL:Null Dwarf_line argument
  3466. DW_DLE_INCL_DIR_NUM_BAD:Error in included directory for given line
  3467. DW_DLE_LINE_FILE_NUM_BAD:File number in .debug_line bad
  3468. DW_DLE_ALLOC_FAIL:Failed to allocate required structs
  3469. DW_DLE_DBG_NULL:Null Dwarf_Debug argument
  3470. DW_DLE_DEBUG_FRAME_LENGTH_BAD:Error in length of frame
  3471. DW_DLE_FRAME_VERSION_BAD:Bad version stamp for frame
  3472. DW_DLE_CIE_RET_ADDR_REG_ERROR:Bad register specified for return address
  3473. DW_DLE_FDE_NULL:Null Dwarf_Fde argument
  3474. DW_DLE_FDE_DBG_NULL:No Dwarf_Debug associated with FDE
  3475. DW_DLE_CIE_NULL:Null Dwarf_Cie argument
  3476. DW_DLE_CIE_DBG_NULL:No Dwarf_Debug associated with CIE
  3477. DW_DLE_FRAME_TABLE_COL_BAD:Bad column in frame table specified
  3478. .TE
  3479. .FG "List of Dwarf 2 Error Codes (contd.)"
  3480. .DE
  3481.  
  3482. .DS
  3483. .TS
  3484. center box, tab(:);
  3485. lfB lfB
  3486. l l.
  3487. SYMBOLIC NAME:DESCRIPTION
  3488. _
  3489. DW_DLE_PC_NOT_IN_FDE_RANGE:PC requested not in address range of FDE
  3490. DW_DLE_CIE_INSTR_EXEC_ERROR:Error in executing instructions in CIE
  3491. DW_DLE_FRAME_INSTR_EXEC_ERROR:Error in executing instructions in FDE
  3492. DW_DLE_FDE_PTR_NULL:Null Pointer to Dwarf_Fde specified
  3493. DW_DLE_RET_OP_LIST_NULL:No location to store pointer to Dwarf_Frame_Op
  3494. DW_DLE_LINE_CONTEXT_NULL:Dwarf_Line has no context
  3495. DW_DLE_DBG_NO_CU_CONTEXT:dbg has no CU context for dwarf_siblingof()
  3496. DW_DLE_DIE_NO_CU_CONTEXT:Dwarf_Die has no CU context
  3497. DW_DLE_FIRST_DIE_NOT_CU:First DIE in CU not DW_TAG_compilation_unit
  3498. DW_DLE_NEXT_DIE_PTR_NULL:Error in moving to next DIE in .debug_info
  3499. DW_DLE_DEBUG_FRAME_DUPLICATE:Multiple .debug_frame sections
  3500. DW_DLE_DEBUG_FRAME_NULL:No data in .debug_frame section
  3501. DW_DLE_ABBREV_DECODE_ERROR:Error in decoding abbreviation
  3502. DW_DLE_DWARF_ABBREV_NULL:Null Dwarf_Abbrev specified
  3503. DW_DLE_ATTR_NULL:Null Dwarf_Attribute specified
  3504. DW_DLE_DIE_BAD:DIE bad
  3505. DW_DLE_DIE_ABBREV_BAD:No abbreviation found for code in DIE
  3506. DW_DLE_ATTR_FORM_BAD:Inappropriate attribute form for attribute
  3507. DW_DLE_ATTR_NO_CU_CONTEXT:No CU context for Dwarf_Attribute struct
  3508. DW_DLE_ATTR_FORM_SIZE_BAD:Size of block in attribute value bad
  3509. DW_DLE_ATTR_DBG_NULL:No Dwarf_Debug for Dwarf_Attribute struct
  3510. DW_DLE_BAD_REF_FORM:Inappropriate form for reference attribute
  3511. DW_DLE_ATTR_FORM_OFFSET_BAD:Offset reference attribute outside current CU
  3512. DW_DLE_LINE_OFFSET_BAD:Offset of lines for current CU outside .debug_line
  3513. DW_DLE_DEBUG_STR_OFFSET_BAD:Offset into .debug_str past its end
  3514. DW_DLE_STRING_PTR_NULL:Pointer to pointer into .debug_str NULL
  3515. DW_DLE_PUBNAMES_VERSION_ERROR:Version stamp of pubnames incorrect
  3516. DW_DLE_PUBNAMES_LENGTH_BAD:Read pubnames past end of .debug_pubnames
  3517. DW_DLE_GLOBAL_NULL:Null Dwarf_Global specified
  3518. DW_DLE_GLOBAL_CONTEXT_NULL:No contect for Dwarf_Global given
  3519. DW_DLE_DIR_INDEX_BAD:Error in directory index read
  3520. DW_DLE_LOC_EXPR_BAD:Bad operator read for location expression
  3521. DW_DLE_DIE_LOC_EXPR_BAD:Expected block value for attribute not found
  3522. DW_DLE_OFFSET_BAD:Offset for next compilation-unit in .debug_info bad
  3523. DW_DLE_MAKE_CU_CONTEXT_FAIL:Could not make CU context
  3524. DW_DLE_ARANGE_OFFSET_BAD:Offset into .debug_info in .debug_aranges bad
  3525. DW_DLE_SEGMENT_SIZE_BAD:Segment size should be 0 for MIPS processors
  3526. DW_DLE_ARANGE_LENGTH_BAD:Length of arange section in .debug_arange bad
  3527. DW_DLE_ARANGE_DECODE_ERROR:Aranges do not end at end of .debug_aranges
  3528. DW_DLE_ARANGES_NULL:NULL pointer to Dwarf_Arange specified
  3529. DW_DLE_ARANGE_NULL:NULL Dwarf_Arange specified
  3530. DW_DLE_NO_FILE_NAME:No file name for Dwarf_Line struct
  3531. DW_DLE_NO_COMP_DIR:No Compilation directory for compilation-unit
  3532. DW_DLE_CU_ADDRESS_SIZE_BAD:CU header address size not match Elf class
  3533. DW_DLE_ELF_GETIDENT_ERROR:Error in elf_getident() on object
  3534. DW_DLE_NO_AT_MIPS_FDE:DIE does not have DW_AT_MIPS_fde attribute
  3535. DW_DLE_NO_CIE_FOR_FDE:No CIE specified for FDE
  3536. DW_DLE_DIE_ABBREV_LIST_NULL:No abbreviation for the code in DIE found
  3537. DW_DLE_DEBUG_FUNCNAMES_DUPLICATE:Multiple .debug_funcnames sections
  3538. DW_DLE_DEBUG_FUNCNAMES_NULL:No data in .debug_funcnames section
  3539. .TE
  3540. .FG "List of Dwarf 2 Error Codes (contd.)"
  3541. .DE
  3542.  
  3543. .DS
  3544. .TS
  3545. center box, tab(:);
  3546. lfB lfB
  3547. l l.
  3548. SYMBOLIC NAME:DESCRIPTION
  3549. _
  3550. DW_DLE_DEBUG_FUNCNAMES_VERSION_ERROR:Version stamp in .debug_funcnames bad
  3551. DW_DLE_DEBUG_FUNCNAMES_LENGTH_BAD:Length error in reading .debug_funcnames
  3552. DW_DLE_FUNC_NULL:NULL Dwarf_Func specified
  3553. DW_DLE_FUNC_CONTEXT_NULL:No context for Dwarf_Func struct
  3554. DW_DLE_DEBUG_TYPENAMES_DUPLICATE:Multiple .debug_typenames sections
  3555. DW_DLE_DEBUG_TYPENAMES_NULL:No data in .debug_typenames section
  3556. DW_DLE_DEBUG_TYPENAMES_VERSION_ERROR:Version stamp in .debug_typenames bad
  3557. DW_DLE_DEBUG_TYPENAMES_LENGTH_BAD:Length error in reading .debug_typenames
  3558. DW_DLE_TYPE_NULL:NULL Dwarf_Type specified
  3559. DW_DLE_TYPE_CONTEXT_NULL:No context for Dwarf_Type given
  3560. DW_DLE_DEBUG_VARNAMES_DUPLICATE:Multiple .debug_varnames sections
  3561. DW_DLE_DEBUG_VARNAMES_NULL:No data in .debug_varnames section
  3562. DW_DLE_DEBUG_VARNAMES_VERSION_ERROR:Version stamp in .debug_varnames bad
  3563. DW_DLE_DEBUG_VARNAMES_LENGTH_BAD:Length error in reading .debug_varnames
  3564. DW_DLE_VAR_NULL:NULL Dwarf_Var specified
  3565. DW_DLE_VAR_CONTEXT_NULL:No context for Dwarf_Var given
  3566. DW_DLE_DEBUG_WEAKNAMES_DUPLICATE:Multiple .debug_weaknames section
  3567. DW_DLE_DEBUG_WEAKNAMES_NULL:No data in .debug_varnames section
  3568. DW_DLE_DEBUG_WEAKNAMES_VERSION_ERROR:Version stamp in .debug_varnames bad
  3569. DW_DLE_DEBUG_WEAKNAMES_LENGTH_BAD:Length error in reading .debug_weaknames
  3570. DW_DLE_WEAK_NULL:NULL Dwarf_Weak specified
  3571. DW_DLE_WEAK_CONTEXT_NULL:No context for Dwarf_Weak given
  3572. .TE
  3573. .FG "List of Dwarf 2 Error Codes"
  3574. .DE
  3575.  
  3576. This list of errors is not necessarily complete;
  3577. additional errors
  3578. might be added when functionality to create debugging information 
  3579. entries are added to \fIlibdwarf\fP and by the implementors of 
  3580. \fIlibdwarf\fP to describe internal errors not addressed by the 
  3581. above list.
  3582. Some of the above errors may be unused.
  3583. Errors may not have the same meaning in different implementations.
  3584.  
  3585. .DS
  3586. \f(CWDwarf_Handler dwarf_seterrhand(
  3587.         Dwarf_Debug dbg,
  3588.         Dwarf_Handler errhand)\fP
  3589. .DE
  3590. The function \f(CWdwarf_seterrhand()\fP replaces the error handler 
  3591. (see \f(CWdwarf_init()\fP) with \f(CWerrhand\fP.  The old error handler 
  3592. is returned.  This function is currently unimplemented.
  3593.  
  3594. .DS
  3595. \f(CWDwarf_Ptr dwarf_seterrarg(
  3596.         Dwarf_Debug dbg,
  3597.         Dwarf_Ptr errarg)\fP
  3598. .DE
  3599. The function \f(CWdwarf_seterrarg()\fP replaces the pointer to the 
  3600. error handler communication area (see \f(CWdwarf_init()\fP) with 
  3601. \f(CWerrarg\fP.  A pointer to the old area is returned.  This
  3602. function is currently unimplemented.
  3603.  
  3604. .DS
  3605. \f(CWvoid dwarf_dealloc(
  3606.         Dwarf_Debug dbg,
  3607.         void* space, 
  3608.         Dwarf_Unsigned type)\fP
  3609. .DE
  3610. The function \f(CWdwarf_dealloc\fP frees the dynamic storage pointed
  3611. to by \f(CWspace\fP, and allocated to the given \f(CWDwarf_Debug\fP.
  3612. The argument \f(CWtype\fP is an integer code that specifies the allocation 
  3613. type of the region pointed to by the \f(CWspace\fP.  Refer to section 
  3614. 4 for details on \fIlibdwarf\fP memory management.
  3615.  
  3616. .SK
  3617. .S
  3618. .TC
  3619. .CS
  3620.